Skip to content

Commit aeba0c1

Browse files
committed
Time: 0 ms (100%), Space: 53.7 MB (16.9%) - LeetHub
1 parent b099e61 commit aeba0c1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @param {string[]} nums
3+
* @return {string}
4+
*/
5+
var findDifferentBinaryString = function(nums) {
6+
let set = new Set(nums);
7+
let len = nums[0].length;
8+
let res = '';
9+
dfs(0, [])
10+
return res;
11+
function dfs(start, temp) {
12+
if (temp.length == len) {
13+
let str = temp.join('');
14+
if (!set.has(str)) {
15+
res = str;
16+
}
17+
return;
18+
}
19+
for (let i = 0; i <= 1; i++) {
20+
temp.push(i);
21+
dfs(i, temp)
22+
temp.pop()
23+
if (res!='') break;
24+
}
25+
}
26+
};

0 commit comments

Comments
 (0)