Pregunta de entrevista de Bloomberg

I had a binary tree and matrix question