Skip to content

Commit aea84ac

Browse files
committed
Runtime: 99 ms (Top 77.76%) | Memory: 45.1 MB (Top 64.02%)
1 parent e498dd6 commit aea84ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// Runtime: 99 ms (Top 77.76%) | Memory: 45.1 MB (Top 64.02%)
12
const sliceRemaining = (s) => s.slice(1, s.length);
23

34
var letterCasePermutation = function(s) {
45
let output = [];
5-
6+
67
const backtracking = (current, remaining) => {
78
if (!remaining.length) return output.push(current);
8-
9+
910
if (/^[0-9]+$/i.test(remaining[0])) {
1011
current += remaining[0];
1112
backtracking(current, sliceRemaining(remaining));
@@ -16,6 +17,6 @@ var letterCasePermutation = function(s) {
1617
}
1718
}
1819
backtracking('', s);
19-
20+
2021
return output;
21-
};
22+
};

0 commit comments

Comments
 (0)