Fractal Interview Question

Elevator logic