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
Provider C# version based on recursive backtracking algorithm, hope it's helpful.
public List generateParenthesis(int n) {
List result = new LinkedList();
Generate("", 0, 0, n, result);
return result;
}
private void Generate(String s, int l, int r, int n, List result){
if(l == n && r == n){
result.add(s);
return;
}
if(l