Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 585 Bytes

File metadata and controls

20 lines (14 loc) · 585 Bytes

Balanced parentheses

Implement a function that takes in a string, and determines if the opening and closing parentheses in the given string are matching correctly returning the appropriate boolean value.

Examples:

Correct cases (should return true):

  • (()()()())
  • (((())))
  • (()((())()))

Incorrect cases (should return false)

  • ((((((())
  • ()))
  • (()()(()

Tips & Tricks

  • There can be characters anywhere between, after or before the parenteses.
  • Think about how can things go wrong, if the amount of opening & closing parentheses are the same.