Kth smallest element in BST
Your task
Given a binary search tree as a level-order array arr (null for missing) and a 1-indexed integer k, return the value of the k-th smallest element. The tree is a valid BST with distinct values and 1 <= k <= node count. 1 <= node count <= 100000.
Examples
kth_smallest_bst(arr: list[int], k: int) -> intExample 1
Input
kth_smallest_bst([3, 1, 4, None, 2], 1)Output
1