Question bank › Recursion
Dsa Recursion Warm-up

Binary String Count

Given a binary string, write a function to count the number of contiguous substrings that have an equal number of 0's and 1's. Input format: A single binary string. Output format: A single integer representing the count of substrings with equal 0's and 1's. Example: Input: '1100' Output: 1 (the substring '11' matches)

Key concepts

recursionstringscounting

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.