Synopsys interview question

Find the height of a binary tree.

Interview Answer

Anonymous

17 Aug 2019

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