IBM Interview Question

DSA - A variant of the valid parenthesis question