As reported: ServiceNow Senior Software Engineer loop, round 1 (coding, 1 hour), Sep 2025: Generate Parentheses and All Paths From Source to Target.
Given n, return all combinations of n pairs of parentheses that are well formed, in any order.
This is LeetCode 22 — Generate Parentheses.
Example
n = 3 -> ["((()))","(()())","(())()","()(())","()()()"]
n = 1 -> ["()"]
Constraints: 1 ≤ n ≤ 8.
Code runner format: one line with n. Implement generateParenthesis(n); the harness sorts your list and prints it.