This came up while talking to a friend and I thought I\'d ask here since it\'s an interesting problem and would like to see other people\'s solutions.
The task is to
An attempt with memoization:
void push_strings(int i, int j ,vector> &T){
for (int k=0; k< T[j].size(); ++k){
for (int l=0; l< T[i - 1 - j].size(); ++l){
string s = "(" + T[j][k] + ")" + T[i-1 - j][l];
T[i].push_back(s);
}
}
}
vector generateParenthesis(int n) {
vector> T(n+10);
T[0] = {""};
for (int i =1; i <=n; ++i){
for(int j=0; j