Sunday common C++ interview problem: Construct a binary max-tree.
Given an array of unique integers, construct a binary max-tree. The tree's root is the maximum value; all elements to the left belong to the left subtree, and all elements to the right belong to the right subtree.
Both subtrees recursively follow the same logic.
Solve it yourself: https://compiler-explorer.com/z/vndE9sj55
Solution: https://compiler-explorer.com/z/dn9ToYbo3