
s가 주어질 때, 영문자는 대소문자를 변경하여 가능한 모든 조합을 생성.별도의 정규식이나 조건문 없이, 모든 위치에서 .toUpperCase()와 .toLowerCase()를 모두 호출하여 탐색합니다.
function letterCasePermutation(s: string): string[] {
const set = new Set<string>()
function dfs(curStr: string) {
if(curStr.length === s.length) {
set.add(curStr)
return
}
const len = curStr.length
dfs(curStr + s[len].toUpperCase())
dfs(curStr + s[len].toLowerCase())
}
dfs('')
return [...set]
};