기출 문제 / 현대 Round 4, Problem 2

Verifying the Departure Order of Commuter Buses

Hyundai Motor Group's research center provides commuter buses for the convenience of its employees.

At the end of the workday, numerous buses are parked in a line in the research center's parking lot. The buses must depart in numerical order, but due to the narrow width of the parking lot, the buses at the front must leave before those at the back can depart.