Clowning on LeetCode Problem #20

Tool #1: Stack

The problem is an easy solve via a stack. I won’t delve into the particulars, but for posterity’s sake:

Tool #99: Reg-who?

In my experience, ‘regex’ is a word that tends to elicit groans or grins from fellow developers.

The Trick

The “complexity” of the problem stems from the possibility of nested brackets as well as sets of brackets in series. However, an observation can be made that simplifies the problem:

  1. ()[]{([])}
  2. _____{()}_
  3. ______{}__
  4. ________

The Bowling Ball



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bryan Haney

Bryan Haney

Full stack web developer with a passion for number theory and algorithms.