Partition Array Into Three Parts With Equal Sum
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Given an integer array arr, decide whether it can be cut into three **non-empty contiguous**
pieces whose sums are all equal.
Formally, return true if there exist indices i and j with 0 < i < j < arr.length such that
arr[0] + ... + arr[i-1], arr[i] + ... + arr[j-1], and arr[j] + ... + arr[arr.length-1] are all
the same value. Otherwise return false.
Aim for a single O(n) pass.
Examples
Constraints
- 3 <= arr.length <= 5 * 10^4
- -10^4 <= arr[i] <= 10^4
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.