data-structures-and-algorithms

401 data structures and algorithms code challenges


Project maintained by alsosteve Hosted on GitHub Pages — Theme by mattgraham

Data Structures and Algorithms

Language: Python

Stack and a Queue: Multi Bracket Validation

Feature Tasks

There are 3 types of brackets:

  1. Round Brackets : ()
  2. Square Brackets : []
  3. Curly Brackets : {}

Whiteboard Process

challenge13

Examples

Input Output
{} TRUE
{}(){} TRUE
()[[Extra Characters]] TRUE
(){}[[]] TRUE
{}{Code}[Fellows](()) TRUE
[({}] FALSE
(]( FALSE
{(}) FALSE

Consider these small examples and why they fail.

Input Output Why
{ FALSE error unmatched opening { remaining.
) FALSE error closing ) arrived without corresponding opening.
[} FALSE error closing }. Doesn’t match opening (.

Unit Tests

Stretch Goal

None

Approach & Efficiency

This one was too hard for me. My solution was a O(N^N) solution so I asked my classmates what they came up with instead. Emily helpped me write this answer but I’m eventually going to come back to this challenge and solve it my own way.