P20810 [GeeksforGeeks] Y shaped pattern4351
普及-
题目描述

Print a Y shaped pattern from asterisks in N number of lines.
Note:
1. N is even.
2. All the strings in the string array which you will return is of length N, so add the spaces wherever required, so that the length of every string becomes N.

Example 1:
Input:
N = 4
Output:
* *
*
*
*
Example 2:
Input:
N = 8
Output:
* *
* *
*

* *
*
*
*
*

Your Task:
You don't need to read input or print anything. Your task is to complete the function yShapedPattern() which takes an Integer N as input and returns a vector of strings where each line represents lines of the pattern. For example, if N = $, the vector v = {" ", " * * ", " * "," * "}.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)

Constraints:
4 <= N <= 200

输入格式

见题面

输出格式

见题面

样例输入
N = 4
样例输出
* * * * * *