Design an algorithm to determine whether a binary tree is valid.
Risposta di colloquio
Anonimo
4 ott 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.