SUMS
CodeChefOpen on judge ↗
Chefina presented her friend Chef with an array of N positive integers, indexed from 1 to N. She challenged Chef with many queries of the form "what is the sum of the numbers between these two indexes?" But Chef was able to solve the problem too easily. Chefina took her array and found all N * (N + 1) / 2 non-empty subarrays of it. She found the sum of each subarray, and then sorted those value
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.
Sign in to chat with the tutor and save your progress.
Sign in to start