Question bank › Bit Manipulation
Dsa Bit Manipulation Easy

Number of Consecutive Ones

Given an integer, you need to find the maximum number of consecutive 1s in its binary representation. For example, for the integer 13 (binary: 1101), the longest sequence of 1s is 2. Input Format: - A single integer n (0 ≤ n < 2^31). Output Format: - Print the length of the longest sequence of consecutive 1s. Example Input: 13 Example Output: 2

Key concepts

bit_manipulationcountingconsecutive

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.