![]() |
VOOZH | about |
Print a ‘Y’ shaped pattern from asterisks in N number of lines.
Examples:
Input: N = 12
Output:* *
* *
* *
* *
* *
* *
* *
*
*
*
*
*
Input: 8
Output:* *
* *
* *
* *
* *
*
*
*
Approach:
Follow the steps to solve this problem:
Below is the implementation of the above approach:
* * * * * * * * * * * * * * * * * * *
Time Complexity: O(N2), for using nested loops.
Auxiliary Space: O(1), as constant extra space is required.