give root binary search tree BST duplicate return mode ie frequently occur element itIf tree mode return orderAssume BST define followsthe leave subtree node contain nod key equal node keythe right subtree node contain nod key greater equal node keyBoth leave right subtree binary search tree Example 1input root 1null22output 2example 2input root 0output 0 constraintsthe number nod tree range 1 104105 Nodeval 105 Follow could extra space Assume implicit stack space incur recursion count