Pregunta de entrevista de Meta

Leetcode tree based medium coding question