Skip to content

Commit c6715d0

Browse files
Time: 50 ms (22.09%) | Memory: 16.4 MB (42.98%) - LeetSync
1 parent 61bf5fa commit c6715d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Solution:
2+
def findDifferentBinaryString(self, nums: List[str]) -> str:
3+
def getint(s):
4+
num = 0
5+
i = 0
6+
for c in s[::-1]:
7+
num += 2**i * int(c)
8+
i += 1
9+
return num
10+
11+
n = len(nums)
12+
vals = [getint(i) for i in nums]
13+
14+
for i in range(n+3):
15+
if i not in vals:
16+
ans = ''
17+
while n:
18+
n -= 1
19+
ans = str(i%2) + ans
20+
i //= 2
21+
return ans

0 commit comments

Comments
 (0)