HARDasked at 1 company

Three Equal Parts

A hard-tier problem at 41% community acceptance, tagged with Array, Math. Reported in interviews at Hotstar and 0 others.

Founder's read

Three Equal Parts is a hard array problem that sounds deceptively simple: split an array into three consecutive subarrays with equal sums. The trap is that a greedy left-to-right scan doesn't work. You need to count total sum, figure out what each part should sum to, then locate the exact boundaries without building extra space. It's asked at companies like Hotstar and sits at 41% acceptance, meaning most candidates either miss the math check or botch the index logic on their first attempt. If this hits your live OA and you blank on the boundary-finding trick, StealthCoder solves it invisibly and surfaces the working indices in seconds.

Companies asking
1
Difficulty
HARD
Acceptance
41%

Companies that ask "Three Equal Parts"

If this hits your live OA

Three Equal Parts is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The core insight: if total sum isn't divisible by 3, return immediately. If it is, each part must sum to total/3. The hard part isn't finding the first and second boundaries, it's verifying they actually exist and handling the case where the array is mostly zeros. You scan left to find where cumulative sum hits target, mark that index, scan further to find the second boundary, then check that the remaining section sums correctly. Most candidates either skip the divisibility check, miscalculate indices, or fail to account for leading/trailing zeros. The problem lives in the verification logic and precise index arithmetic, not the algorithmic concept itself. When you're under time pressure in the assessment and the boundary math tangles, StealthCoder runs undetected and provides the correct partition indices.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Three Equal Parts recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Three Equal Parts interview FAQ

Why does a greedy left-to-right scan fail here?+

Because finding indices where cumsum equals target/3 isn't enough. You also have to verify the remaining third actually sums to target/3. Greedy finds boundaries but doesn't validate they create equal parts. The problem demands both discovery and proof.

What's the trick when the array has lots of zeros?+

Zeros don't change cumulative sum. You can hit target/3 early, but the first boundary must be placed so there's still room for two more equal parts. You need to track the first valid boundary, then the first valid second boundary after it, to avoid overlapping slices.

Is Three Equal Parts still asked at FAANG and other top companies?+

Data shows it's asked at least once at Hotstar. It's a hard problem with 41% acceptance, so it's not frequent, but companies still use it to test math reasoning and boundary handling. Don't ignore it assuming it's outdated.

How does this relate to the Array and Math topics listed?+

Array covers the iteration and index logic. Math covers the divisibility check and the insight that equal-sum partitions require total sum divisible by 3. Both are mandatory: you can't solve it without either.

What's the most common mistake candidates make?+

Returning the first pair of boundaries that hit cumsum equals target and 2*target, without checking that the third section actually sums to target. Off-by-one errors in index assignment also plague this problem under time pressure.

Want the actual problem statement? View "Three Equal Parts" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.