Quant Memo
Coding/●●●●●

Generate all balanced bracket sequences

Produce all well-formed strings of n pairs of parentheses. "Well-formed" means every ( is eventually closed and no ) ever appears without a matching open before it.

n = 2
-> ["(())", "()()"]

Return every balanced sequence of n pairs. The number of them is the nth Catalan number.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions