Pergunta de entrevista da empresa R3

Write a method that counts the brackets nesting and finds the deepest one.