Lift Requests
Chef lives in a huge apartment building with $N$ floors, numbered $0$ (ground floor) through $N$ (terrace). Unfortunately, it has only one lift. We say that when the lift travels from a floor $a$ to a floor $b$, it travels $|b-a|$ floors. Initially, the lift is on the ground floor. Then, it receives $Q$ requests (numbered $1$ through $Q$). For each valid $i$, the $i$-th request is for the lift
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