← The arcade

Machines · difficulty 3 of 3

Lift controller 🛗

A lift starts at floor 0 going up. It serves all requested floors above it in ascending order, then reverses and serves the rest in descending order (the SCAN algorithm). Print the floors visited in order and total floors travelled.

This one is part of Pro. Plenty of arcade challenges are free to play right now.

Skills: dicts, if/else, loops

Open the arcade