Find The K-th Lucky Number

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from collections import deque

class Solution:
    def kthLuckyNumber(self, k: int) -> str:
        out = ""
        k += 1
        while k != 1:
            out = ("7" if k & 1 else "4") + out
            k //= 2
        return out