ShipBob Interview Question

coding problem on balance parenthesis along with a variation.