AfterShip interview question

coding problem: leetcode matched parenthesis