Braze Interview Question

leetcode style question related to parenthesis