← All problemsSign in

Ringroad houses

Neha lives in a city that has $n$ houses built along the main ring road. The ring roadhouses are numbered 1 through $n$ in the clockwise order. The ring road traffic is one way and also is clockwise. Neha has recently moved into the ring roadhouse number 1. She has to traverse the $m$ number of houses in the given input sequence $a_1$,$a_2$, ...,$a_m$ (1 ≤ $a_i$ ≤ n). Find the minimum time she

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