Reported May 2025
Dellcounting

Count Binary Substrings

Reported by candidates from Dell's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Dell OA. Under 2s to a working solution.
Founder's read

Dell asked this in May 2025, and it's a string problem that catches people off guard because the pattern is hiding in plain sight. You're counting consecutive groups of 0s and 1s, then looking for adjacent pairs where the counts match exactly. It's not a brute-force substring check. The trick is recognizing that you only need to track group sizes, not iterate through every possible substring. If you blank on the approach during the OA, StealthCoder will feed you the group-tracking pattern so you can write it clean.

Pattern and pitfall

The core insight is that a valid binary substring has the form 0...01...1 (or reversed) where the 0-group size equals the 1-group size. Instead of checking all O(n^2) substrings, compress the string into runs: a sequence of consecutive identical characters becomes a single count. Then walk through those counts and add min(counts[i], counts[i+1]) for each adjacent pair. This is a one-pass linear scan after compression. The pitfall is overthinking it as a sliding-window or substring-matching problem. It's really about counting transitions between group boundaries. StealthCoder spots this pattern instantly if you describe the input, so use it as a safety net if your first approach feels tangled.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Count Binary Substrings cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as count binary substrings. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Dell's OA.

Dell reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Binary Substrings FAQ

What makes this different from a regular substring search?+

You're not checking every substring. You're compressing runs of identical bits into counts, then pairing adjacent runs. If a run of 0s has size 3 and the next run of 1s has size 2, you get 2 valid substrings from that pair. It's a counting problem, not a search problem.

Do I need dynamic programming or memoization?+

No. This is a single pass after grouping. Once you have the run lengths, you iterate through pairs and sum the minimums. O(n) time, O(1) space if you don't store all groups explicitly.

What's the most common mistake?+

Trying to validate substrings individually instead of recognizing the group-pairing pattern. People write nested loops and time out. Stop thinking substring-by-substring and think group-by-group instead.

How do I prepare for this in 48 hours?+

Understand the problem by hand on a small example like '00110'. Trace through: groups are [2, 2]. Adjacent pair contributes min(2,2)=2. Write the grouping logic first, then the pairing sum. That's it.

Will Dell ask follow-ups about edge cases?+

Likely. Be ready for all 0s, all 1s, single character, and alternating patterns. These should all work naturally with your group logic. Test them before you submit.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Dell.

OA at Dell?
Invisible during screen share
Get it