Find Mode in Binary Search Tree

Easy · Binary Search Trees · about 15 minutes

Asked at Google, Amazon, Microsoft.

A BST may contain duplicates (left subtree ≤ node ≤ right subtree). Return all the most frequent values, in any order. Can you avoid extra space (beyond recursion)?

Related guides