Tripadvisor interview question

Leetcode Vaild Parenthesis but more cutomised easy version