Skip to content

Letter Case Permutation

MediumBacktracking
Decode it first. Clues, constraints, pattern and plan before any code.

Given a string s of letters and digits, you may turn each letter into lower case or upper case independently. Digits stay as they are. Return every string you can make this way, in any order.

"a1b2"   →  ["a1b2", "a1B2", "A1b2", "A1B2"]
"3z4"    →  ["3z4", "3Z4"]
"12345"  →  ["12345"]

Constraints

  • 1 <= s.length <= 12
  • s contains only English letters and digits.