← All problemsSign in

Sum within Range

You are initially given an array of $N$ integers. Given this array, you have to perform 2 kinds of operations: $1$ $L$ $R :$ You are given 2 integers $L$ and $R$. You need to return the sum of all the elements with indices between $L$ and $R$ ( both inclusive ). That is, if the elements currently in the array are a1, a2, a3.... an, you need to return the following sum : aL + aL+1 + aL+2 ... + aR.

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