230. Kth Smallest Element in a BST

Practice Kth Smallest Element in a BST for free on NudgeCode: Medium, Binary Tree pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Given the root of a binary search tree and an integer k, return the k-th smallest value in the tree (counting from 1).

Example

root = [5,3,6,2,4,null,null,1], k = 3  ->  3

Constraints