Question bank › Bit Manipulation
Dsa Bit Manipulation Easy

The Digital Democracy

Given a list of 32-bit unsigned integers, find the 'Consensus Integer'. The i-th bit of the Consensus Integer is 1 if and only if strictly more than half of the integers in the input list have their i-th bit set to 1. Otherwise, the i-th bit is 0. Input: A line containing N, followed by N integers. Output: The Consensus Integer in decimal format. Example: Input: 3 1 2 3 Explanation: 1: 01 binary 2: 10 binary 3: 11 binary Bit 0: Two 1s, one 0. (2 > 1.5) -> 1 Bit 1: Two 1s, one 0. (2 > 1.5) -> 1 Result: 11 binary = 3. Output: 3

Key concepts

bit_manipulationlogic_gates

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.