Checking whether a series of parenthesis is balanced and valid is a classic puzzle in computer science and can be easily met during a job interview.
Even if a regular expression can be a perfect solution, the problem can be also solved using an easy algorithm that makes use of recursion and a LIFO data structure such as a stack.
In this post, the algorithm is presented together with its F# implementation.
Add your comment