← All problemsSign in

Intervals and subarrays

Chef Rahul likes those arrays that can be rearranged to form an interval of values - an increasing sequence where each element is greater than the previous by exactly one. For example: - Rahul likes the array [3, 6, 5, 4] as it can be re-arranged to [3, 4, 5, 6]. - Rahul doesn't like [1, 2, 4, 5] as no clear interval can be defined from these elements. Given an array a of length n, your ta

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