Pregunta de entrevista de Gartner

DSA based question- Balance brackets