Ezvor

2802. Find The K-th Lucky Number

MediumMath Preparing judge… LeetCode
MathStringBit Manipulation

Hints

Hint 1
The number of lucky numbers with exactly n digits is equal to 2n.
Hint 2
We can obtain how many digits the kth lucky number has.
Hint 3
Imagine we know that kth lucky number has c digits. Then calculate how many numbers with c digits exist before the kth lucky number.
Hint 4
Imagine the number from the previous hint is x. Now look at the binary representation of x and add some leading zero to make its length equal to c.
Hint 5
Replace 0 and 1 with 4 and 7 in the number you've obtained from the previous hint.