MaxFinder
CodeChefOpen on judge ↗
This new year Pratyush got an interesting problem as a gift. You are given a sequence of $n$ numbers $A1, A2, A3, ......., An$. For each number $Ai$, find a number $Aj$ such that: 1. $Aj > Ai$ 2. $j > i$ 3. $|j-i|$ is minimum If no such $Aj$ exists print $-1$. Input: The first line of input consists of $T$, the number of test cases. Each test case consists of $n$ - the number of integers
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