Domanda di colloquio di Amazon

Code to get the depth of a binary tree.

Risposte di colloquio

Anonimo

7 set 2011

int depth(node * root) { if (root == null) return 0; return max(depth(root->left), depth(root->right) + 1; }

Anonimo

8 lug 2011

should be easy if you have done it before.