Dsa
Bit Manipulation
Medium
Rearranging Bits
You are given an integer. Rearrange the bits of the integer in ascending order and return the new integer value.
Input format:
The first line contains a single integer (0 <= value <= 10^6).
Output format:
Print the rearranged integer.
Example:
Input: 13
Output: 9
Key concepts
bit_manipulationrearrangement
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now