Dsa
Bit Manipulation
Easy
The Orbital Shift
You are given two 32-bit unsigned integers, A and B. Determine if A can be transformed into B by performing any number of cyclic right shifts (0 to 31 shifts). A cyclic right shift moves the LSB to the MSB position.
Input: Two space-separated integers A and B.
Output: The string 'YES' if B is a cyclic rotation of A, otherwise 'NO'.
Example:
Input: 1 2147483648
Explanation:
1 in 32-bit: 00...0001
2147483648 in 32-bit: 100...0000
One cyclic right shift of 1 results in 2147483648.
Output: YES
Key concepts
bit_manipulationcyclic_shift
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