Let us construct a Binary Tree 4 / \ 4 4 / \ \ 4 9 5
Node * root = NULL ; root = newNode ( 4 ) ; root -> left = newNode ( 4 ) ; root -> right = newNode ( 4 ) ; root -> left -> left = newNode ( 4 ) ; root -> left -> right = newNode ( 9 ) ; root -> right -> right = newNode ( 5 ) ; cout << longestSameValuePath ( root ) ; return 0 ; }