Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

The Deepest Suffix Match

Given an array of N integers, find the maximum integer K such that there exist two distinct indices i and j (i != j) where the XOR of A[i] and A[j] has at least K trailing zeros. If all numbers are distinct and no trailing zeros exist in any XOR pair, K=0. Trailing zeros in XOR essentially means the numbers share a binary suffix of length K. Input Format: An integer N, followed by N space-separated integers. Output Format: A single integer K. Example: Input: 4 10 26 42 58 Output: 4 (Explanation: 10 is ...01010, 26 is ...11010. XOR is 16 (...10000), which has 4 trailing zeros. All pairs here share the suffix '1010'.)

Key concepts

bit_manipulationmodular_arithmetichashing

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