Leverage Edu Interview Question

Stack based balanced paranthesis, easy followup