Domanda di colloquio di DXC Technology

I was asked to solve a coding question about balancing the brackets.