Synopsys Interview Question

Find the height of a binary tree.

Interview Answer

Anonymous

Aug 17, 2019

Literally 2 lines: If (!node) return null; return 1+max(height(node->left), height(node->right));