Sponsored
Use these hints if you're stuck. Try solving on your own first.
Simulate the problem. Count the number of 1's in the binary representation of each integer.
Sort by the number of 1's ascending and by the value in case of tie.
Solve with full IDE support and test cases