← All problemsSign in

Chef and array

Problem Statement Chef has an array of N numbers . Chef wants to know the number of ways to divide it into 3 contiguous parts such that the sum of the three parts is equal . Formally you need to find number of indices i,j such that sum of elements from 1 to i-1 = sum of elements from i to j = sum of elements from j+1 to N . Input The first line contains an integer N . Then the next line has N i

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start