Pergunta de entrevista da empresa HARMAN

In dsa they asked valid parenthesis problem