1. The pattern will consist of 2 * ‘N’ - 1 lines.
2. The pattern will consist of ‘ ’ (space) and ‘*’ (asterisk) characters only.
3. The pattern will be an arrow pattern.
4. For a value 'i', the arrow pattern starts with 'i' ‘ ’ (space) characters and then has 'i' ‘*’ (asterisk) characters.
5. The value of 'i' starts from 1, increases till ‘N’ and then decreases till 1.
If ‘N’ is 5 then the pattern will be (there is a space before the first asterisk):
*
**
***
****
*****
****
***
**
*
The first line of input contains an integer 'T' representing the number of test cases.
Then each test case contains a single integer ‘N’ denoting the size of the pattern.
For each test case, print the 'N' strings denoting the pattern.
The output of each test case will be printed in a separate line.
1 <= 'T' <= 10
1 <= 'N' <= 1000
Where ‘T’ is the number of test cases, ‘N’ is the size of the pattern.
You do not need to print anything, it has already been taken care of. Just implement the given function.
The idea is here to maintain 2 strings 1 for ‘ ‘ characters and 1 for ‘*’ characters, now in each step till ‘N’ we will append 1 ‘ ‘ character in 1st string and 1 ‘*’ character in 2nd string. After ‘N’ in each step, we will remove 1 ‘ ‘ character from the 1st string and 1 ‘*’ character from the 2nd string. At each step, we will append concatenation of both strings to our pattern.
Print Name
Print Name
Print Name
Print Name
Print Name
Matrix Boundary Traversal
Star Triangle
Count Repeating Digits
Inverted Left Half Pyramid