diff --git a/medium/find_unique_binary_string.py b/medium/find_unique_binary_string.py new file mode 100644 index 0000000..5009444 --- /dev/null +++ b/medium/find_unique_binary_string.py @@ -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 +