← All problemsSign in

Find the prefix sum

Given an array of $N$ numbers. You have perform $Q$ queries. Queries are of 2 types query 1: $1\space X$: find the index of the array such that the prefix sum is X query 2: $2\space U \space V$: change the value of array at index U to value V (1 based indexing) Prefix sum at a index $x$ is sum of array elements from first elements to index x. Note - It is guaranteed for query 1 $X$ will be the

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