← All problemsSign in

Republic Subarray

Given an integer $N$, and an array of $N$ elements. Your task is to find the special subarray of maximum size. A Special subarray here is defined as a subarray which starts with $1$ and proceeds with consecutive numbers, i.e, 1,2,3,4,5,… and so on. Hence if a special subarray exists which starts from 1 and ends with $m$ (1,2,3,4,….,m), then its size will be equal to $m$. Among all the

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