Srikant And The Game
CodeChefOpen on judge ↗
Srikant is playing a game with his son Atharv. Initially Atharv has an array of size $N$. i.e $arr[0 ... N-1]$.Srikant has $Q$ queries. Each query consists of two integers $i$ and $j$. For each query Atharv has to report the majority element of the subarray from index $i$ to index $j$. The majority element of the subarray is the element that appears more than $\left \lfloor{n/2}\right \rfloo
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