Question bank › Two Pointers
Dsa Two Pointers Hard

Partition Array into Three Parts

You are given an array of integers. Your task is to partition this array into three contiguous parts such that the sum of each part is the same. If it is possible, return the indices to split the array. Otherwise, return a message indicating failure. The function should read from standard input and print the result. Example: Input: 6 1 1 1 2 2 2 Output: 2 4 Explanation: The parts [1, 1, 1], [2, 2], and [2] have equal sums of 3.

Key concepts

two_pointerspartitionarray_manipulation

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.