← All problemsSign in

Subarray Sum

SubarraySet of an array is defined as the set of sum of each subarray of the array. More formally for array A, SubarraySet of A consists of Ai + Ai+1 .. Aj for 1 ≤ i ≤ j ≤ N .For example, SubarraySet of array [1,2,5] is the set {1,2,3,5,7,8}. A is an array of positive integers having N elements. The elements of the array are not known. However, it is known that the sum of all elements of A is S.

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