bumpsoo 2025-02-20 11:46:07 +00:00
parent ec9e48aafa
commit b23b0179f0

View file

@ -0,0 +1,17 @@
# https://leetcode.com/problems/find-unique-binary-string
from typing import List
class Solution:
def findDifferentBinaryString(self, nums: List[str]) -> str:
length = len(nums)
kv = {num: True for num in nums}
result = ''
fmt = '0' + str(length) + 'b'
max = 2 ** length
for i in range(max):
result = format(i, fmt)
if result not in kv:
break
return result