Stack Machine
CodeChefOpen on judge ↗
Stack Machine A mathematician observes one person get on a bus. Then two people get off the bus. The mathematician says: "If one more person gets on the bus, the bus will be empty." A stack machine is a special kind of bus. It only has doors at the front, and it is so narrow that the people on the bus cannot move past each other. Of the people on the bus, the person who got on the bus last must
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