Netflix Interview Question

A problem similar to Valid Parentheses leetcode.