Given the root of a binary search tree, a target value, and an integer k, return the k keys closest to the target, sorted in ascending order. When two keys are equally distant, prefer the smaller. The input gives a level-order BST array and 'target k' separated by ' | '.
Input: A level-order BST array and 'target k', separated by ' | '.
Output: Array — the k closest keys, sorted ascending.
Input: [8,3,10,1,6,null,14,null,null,4,7,13] | 5 3
Output: [3,4,6]
Explanation: Three keys nearest to 5.Input: [4,2,7,1,3] | 6 2
Output: [4,7]
Explanation: Two nearest to 6.Input: [5] | 3 1
Output: [5]
Explanation: Only key.1<=k<=nodes<=10^4valid BST