I got to the bottom and couldn&#x27;t believe that the solution chosen was to modify the regexp instead of use a for loop.  He did such a great job explaining that the code is really just trying to count the number of parentheses or braces to see if they&#x27;re imbalanced, that it felt the next step was &quot;so I wrote a really simple set of loops that is fast enough on short strings and way less crazy otherwise&quot;.