Question bank › Bit Manipulation
Dsa Bit Manipulation Easy

The Parity Vault

In a digital vault, each key is a 32-bit integer. A key is considered 'stable' only if it has an even number of set bits (even parity). If a key is not stable (odd parity), it must be modified by flipping its least significant bit that is currently OFF (0) to ON (1). Given a list of N keys, identify the stable version of each key and output the bitwise XOR sum of all these stable keys. Example: Input: 3 2 4 7 Output: 9 Explanation: 2 (10) has 1 bit; LSB off is bit 0. New key: 2 | 1 = 3 (11). 4 (100) has 1 bit; LSB off is bit 0. New key: 4 | 1 = 5 (101). 7 (111) has 3 bits; LSB off is bit 3. New key: 7 | 8 = 15 (1111). XOR Sum: 3 ^ 5 ^ 15 = 9.

Key concepts

bitwise_xorparitybit_manipulation

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.