Interview Query

Check Matching Parentheses

Have you seen this question before?

One of the basic steps in parsing string inputs is to check whether the opening and closing characters or tags match, i.e., to check if each opened parenthesis is closed eventually.

Given a list of strings, write a string parser that verifies the integrity of the parenthesis used in the string. The parser should return a list of booleans stating whether that string’s integrity was verified.



list_of_strings = [
    'f(x) + g(x)', 
    '((())just some string)', 


def string_parser(list_of_strings) -> [True, False, True, True]
Next question: Daily Active Users
Python 3.9.6
Loading editor
Use Shift + Enter to run code