LLD - Design — Elevator System
Given the following pseudo-code for state transitions, what will be the final state after these events:
start at idle, move up, move down, idle?
state = 'idle'
if event == 'move up' and state == 'idle':
state = 'moving up'
elif event == 'move down' and state == 'idle':
state = 'moving down'
elif event == 'stop' and state in ['moving up', 'moving down']:
state = 'idle'