Pregunta de entrevista de Qualcomm

Design a state machine from scratch and show me the code.