Code RoomLetter case permutations
EasyPrep Room Coding #933

Letter case permutations

CodingAlgorithms & data structuresMid~15 min

Given a string s (length 1..12) of letters and digits, you may transform every letter into either lowercase or uppercase (digits are unchanged). Return all strings that can be created this way, sorted ascending. The number of outputs is 2 raised to the number of letters in s.

Implement
letter_case_permutation(s: str) → list[str]
Examples
in["a1b2"]out["A1B2","A1b2","a1B2","a1b2"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 15 min
InputExpectedGot
["a1b2"]["A1B2","A1b2","a1B2","a1b2"]not run yetsample