hi, let Avik connect you.


** You can give your thought about this content and request modifications if needed from Ask For Modifications page. Thank You.

** You can check all the posts on the Posts page.

** More about me in the About Me section.

Patternify


  • Approach:

    1. Just printed the pattern as instructed on the question.


  • Time and Space Complexity:

      • Time Complexity: O(N*N)

      • Space Complexity: O(N*N)


Code [C++]

#include <bits/stdc++.h>

vector<string> printPatt(int n)

{

vector<string>answer;

for(int i=0; i<n; i++){

string ret = "";

for(int j=0; j<n-i; j++){

ret += '*';

}

// cout<<ret<<endl;

answer.push_back(ret);

}

return answer;

}