Question bank › Recursion
Dsa Recursion Warm-up

The Binary Descent

A number descends to zero following two rules: if it is even, divide it by 2. If it is odd, subtract 1 from it. Use recursion to count how many steps it takes to reach 0. Input Format: A single integer N. Output Format: A single integer representing the step count. Example: Input: 10 Output: 5 (Explanation: 10 -> 5 -> 4 -> 2 -> 1 -> 0 is 5 steps)

Key concepts

recursionarithmetic

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.