Dsa
Bit Manipulation
Easy
Rotate Bits Right
Given an integer n and an integer k, return the integer obtained by rotating the bits of n to the right by k positions. The bits that are shifted out from the right should reappear on the left.
Input:
Two integers n and k (0 ≤ n ≤ 10^9, 0 ≤ k ≤ 31)
Output:
The resulting integer after right rotation of bits.
Example:
Input:
16 2
Output:
4
Key concepts
bit manipulationrotation
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