Minimum BST height

Write codeMedium20 min

Your task

Given a strictly increasing sorted array sorted_vals, you may build a binary search tree from it by repeatedly choosing a value as the root and recursing on the left and right halves. Return the minimum possible height of such a BST, where height is the number of nodes on the longest root-to-leaf path (an empty tree has height 0, a single node has height 1). 0 <= len(sorted_vals) <= 100000.

Examples

balanced_bst_height(sorted_vals: list[int]) -> int
Example 1
Inputbalanced_bst_height([1, 2, 3, 4, 5, 6, 7])
Output3