← All problemsSign in

Omi and Segment Trees

*Omi* loves to play with Segment Trees. Now, *Govi* wants to test his knowledge about segment trees. He gave him a array of length $N$, where each element of the array is from $1$ to $K$ ( both inclusive ) . He asked him $Q$ queries of two types : - Type 1 : 1 $u$ $v$ -> Update the value at position $u$ to $v$. - Type 2 : 2 -> Find the length of the shortest contiguous subarray which contain a

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