Pregunta de entrevista de Bloomberg

Design an algorithm to determine whether a binary tree is valid.

Respuesta de la entrevista

Anónimo

4 oct 2018

I wrote pseudocode for DFS and also kept a set with all seen node ids. If I saw the same id more than once, I returned false. If I got through the search, then I returned true.