Find Kth Bit in Nth Binary String LeetCode solution in Python

1
class Solution:
2
def findKthBit(self, n: int, k: int) -> str:
3
i, s, hash_map = 1, "0", {"1": "0", "0": "1"}
4
for i in range(1, n):
5
s = s + "1" + "".join((hash_map[i] for i in s))[::-1]
6
return s[k - 1]

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0