HSBC Interview Question

Valid paranthesis question on leetcode