Number Query
CodeChefOpen on judge ↗
Given a sorted array $[A$$1$$,A$$2$$,A$$3$$...A$$n$] of $N$ elements and you have to process $Q$ queries of the following type, In each query you will be, * given a number $X$ for which you have to find the Left and Right border of the Longest Segment which contains only $X$. For eg. Let us say that the array given is: ${ 1, 2, 2, 3, 3, 3, 4, 7 }$ and the first query $( X = 3 )$ then the answer
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