If curr node and it 's right child has same value
if ( node -> right && node -> right -> val == node -> val ) Rightmax += right + 1 ; * ans = max ( * ans , Leftmax + Rightmax ) ; return max ( Leftmax , Rightmax ) ; }