MathWorks Interview Question

I've written question in my description. FSM and non deterministic FSM