#3821

Find Nth Smallest Integer With K One Bits

master · 1875 · lc hard +32 · 34.2% accepted · 66 likes · top 12%

Description

Given two positive integers n and k, find and return the nth smallest positive integer whose binary representation contains exactly k set bits. The answer is guaranteed to be strictly less than 250.

Code

1
2
3