Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your solution is actually an optimized implementation of a pushdown automata.

nesting_depth is the stack. There is only one kind of symbol that can be pushed, so it's represented as a simple count of the number of symbols that are on the stack.



Okay, but I don't need to know the concept of a PDA to implement that, nor would I assume a candidate understands PDAs from reading that code.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: