Tesla Interview Question

Python related code challenges about state machine and tree data structures