Top Hat Interview Question

Balanced Parentheses - Leetcode question