<p>Given the <code>root</code> of a binary search tree, and an integer <code>k</code>, return <em>the</em><code>k<sup>th</sup></code><em>smallest value (<strong>1-indexed</strong>) of all the values of the nodes in the tree</em>.</p>
<p><strong>Follow up:</strong> If the BST is modified often (i.e., we can do insert and delete operations) and you need to find the kth smallest frequently, how would you optimize?</p>