Sollicitatievraag bij Bloomberg

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

Antwoord op sollicitatievraag

Anoniem

4 okt 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.