From the course: Nail Your Java Interview

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Matching parentheses

Challenge: Matching parentheses - Java Tutorial

From the course: Nail Your Java Interview

Start my 1-month free trial

Challenge: Matching parentheses

(gentle music) - It's time for more practice with data structures. In this challenge, you'll develop a function that determines if a given piece of text has matching parentheses. Although a parentheses is traditionally a curved character, we are considering square brackets and arrow brackets parentheses as well. These first set of symbols have matching blocks symbols because they have an opening with the corresponding closing. The opening symbol also comes before the closing parentheses. The second set of inputs do not have matching parentheses because they do not start with an opening blocks symbol or they do not have a closing symbol for each opening. Your function should take in a string and return a Boolean that is true if the string has matching block symbols or false if the string does not have matching block symbols. This is a commonly asked technical interview question that will test your skills in Java. Good luck.

Contents