Apple interview question

State machine for a traffic light controller