Problem of the day
You are given an integer ‘N’, ‘N’ will always be an odd integer. Your task is to print a pattern with the following description:
1. The pattern will consist of ‘N’ lines.
2. The pattern will consist of ‘ ‘ (space) and ‘*’ characters only.
3. The pattern will be a “Void of Diamond” pattern.
4. A “Void of Diamond” pattern is a pattern ‘N’ * ‘N’ cells and ‘ ‘ characters make a diamond shape and ‘*’ fill all other points.
5. For a better understanding of the “Void of Diamond” pattern refer to example and sample input-output.
For example:
If ‘N’ is 5 then the pattern will be-
*****
** **
* *
** **
*****
Input Format:
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.
Output Format:
For each test case, print 'N' strings denoting the pattern.
The output of each test case will be printed in a separate line.
Constraints:
1 <= T <= 5
3 <= N <= 500
Where ‘T’ is the number of test cases, ‘N’ is the size of the pattern. ‘N’ will be odd for all test cases.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
2
5
3
*****
** **
* *
** **
*****
***
* *
***
Test Case 1:
Given ‘N’ = 5
We will print the pattern as the description of the “Void of Diamond” pattern.
Test Case 2:
Given ‘N’ = 3
There will be only 1 ‘ ‘ space in the diamond pattern.
2
7
9
*******
*** ***
** **
* *
** **
*** ***
*******
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********
Test Case 1:
Given ‘N' = 7
The pattern is printed such that ‘ ‘ making a diamond and ‘*’ filling other points.
Test Case 2:
Given ‘N’ = 9
Created a 9*9 grid and all space cells make a diamond pattern.