Brace Expansion
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a pattern string s made of lowercase letters and brace groups. A brace group such as {a,b,c} lists alternative letters, and exactly one of them is chosen for that position. A letter outside braces is fixed. Groups are never nested.
Return every word the pattern can produce, sorted in ascending lexicographic order. Every group has distinct options, so the result has no duplicates.
Examples
Constraints
- 1 <= s.length <= 50
- s contains lowercase letters, `{`, `}` and `,`
- Every option inside a group is a single letter, and options in one group are distinct
- Braces are balanced and never nested; every group has at least one option
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.