3 ms·
Usually your state is more complicated than just one enum. You'll have counters, buffers, etc. The only time I've ever used a state machine in real code is whe
by hot_gril 4y ago
Usually your state is more complicated than just one enum. You'll have counters, buffers, etc.
The only time I've ever used a state machine in real code is when parsing text one token at a time or something like that. It's a useful skill to remember for those situations. And this kind of problem is very over-represented in SWE interviews.
- BlueTemplar 4y agoWell yes, because state machines are identical to regular expressions... though regular expressions tend to be used quite a lot ?
- hot_gril 4y agoYeah, in most cases I won't even get into manual parsing and will use a regex instead. But sometimes I have to break out the FSM.