← All problemsSign in

Subarray Problem

Ajay has an array A consisting of N non-negative integers. Initially, all the elements are zero. Assume 1-based indexing. Chef is given two positive integers L and R. (L <= R) Chef has to execute Q number of queries on the array A. These queries can be of the following two types: 1 x y (1 ≤ x ≤ n) - Replace the value of xth array element by y. 2 l r (1 ≤ l ≤ r ≤ n) - Return the number of subarra

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