We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82e07a0 commit 5a1329cCopy full SHA for 5a1329c
solution/0784.Letter Case Permutation/Solution.java
@@ -0,0 +1,20 @@
1
+class Solution {
2
+ public List<String> letterCasePermutation(String S) {
3
+ char[] cs = S.toCharArray();
4
+ List<String> res = new ArrayList<>();
5
+ dfs(cs, 0, res);
6
+ return res;
7
+ }
8
+
9
+ private void dfs(char[] cs, int i, List<String> res) {
10
+ if (i == cs.length) {
11
+ res.add(String.valueOf(cs));
12
+ return;
13
14
+ dfs(cs, i + 1, res);
15
+ if (cs[i] >= 'A') {
16
+ cs[i] ^= 32;
17
18
19
20
+}
0 commit comments