Print all valid combinations of n pairs of parentheses
Filed under Samsung
The question
Given n pairs of parentheses, write a recursive/backtracking algorithm to generate and print all valid (balanced) combinations of parentheses.
No write-up yet. Related questions below have one.
Related Samsung questions
Collected from public candidate posts and coding forums. Updated Nov 2026.