![]() |
VOOZH | about |
Given any alphabet between A to Z, the task is to print the pattern of the given alphabet using star.
Examples:
Input: A Output: ** * * ****** * * * * Input: P Output: ***** * * ***** * *
Approach: The code to print each alphabet is created in a separate function. Use switch statement to call the desired function on the basis of the alphabet's pattern required.
Below is the implementation.
** * * ****** * * * *
Time complexity: O(h^2) where h is height of the alphabet
Auxiliary space: O(1)