Dsa
Bit Manipulation
Medium
Cyclic Shift Coverage
You are given a target bitmask T and a list of key bitmasks. Each key can be cyclically shifted (32-bit) by any number of positions [0, 31]. Determine if it is possible to choose exactly one shift for some subset of keys such that the bitwise OR of these shifted keys equals exactly T. Note: You must not set any bit that is 0 in T.
Input Format:
An integer T.
A space-separated list of key integers.
Output Format:
'YES' or 'NO'.
Example:
Input:
7
1
Output:
YES
(Explanation: Target 7 is binary 111. Key 1 (0...001) can be shifted to 1, 2, and 4. 1|2|4 = 7.)
Key concepts
bit_manipulationgreedy
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