Problem title
Difficulty
Avg time to solve

Find Longest Sequence
Moderate
15 mins
Diamond of numbers
Moderate
15 mins
Galaxy of stars
Easy
15 mins
Arrow Pattern
Easy
10 mins
Row Wave Form
Easy
15 mins
Median of a BST in O(1) space
Easy
10 mins
Minimize the maximum difference between adjacent elements in an array
Easy
15 mins
Check If Two Expressions With Brackets Are Same
Easy
16 mins
Total Number of BSTs using array elements as root node
Moderate
15 mins
Binary strings with no consecutive 1s.
Moderate
25 mins
4

Galaxy of stars

Difficulty: EASY
Contributed By
Avg. time to solve
15 min
Success Rate
80%

Problem Statement

Ninja wants to build a star pattern for a given odd number.

The pattern for ‘N’ = 7  will look like this:

*
**
***
****
***
**
*

Your task is that for a given odd integer 'N', print the pattern.

Input Format:
The first line contains an integer 'T' which denotes the number of test cases or queries to be run.

The first line of each test case contains one integer, ‘N’, denoting the number of rows.
Output Format:
For each test case, print 'N' strings denoting the pattern.

The output of each test case will be printed on a separate line.
Note:
You do not need to input or print anything, as it has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 5
1 <= N <= 99

Time Limit: 1 sec
Sample Input 1:
2
3
5
Sample Output 1:
*
**
*
*
**
***
**
*
Explanation of Sample Input 1:
Test case 1:

In the first test case of sample input 1, we need to print a triangle-like pattern wherein each line, the number of stars will be increasing till the central row and then it starts decreasing. So for n=3, till 2nd-row stars increase and then start decreasing.
Sample Input 2:
1
1
Sample Output 2:
*
Explanation of Sample Input 2:
Test case 1:
As ‘N’ is equal to ‘1’, we just need to print one line. 
Reset Code
Full screen
copy-code
Console