Salesforce Interview Question

Leetcode medium question involving parenthesis