Algorithm · Amazon · Medium
You are provided with the root node of a binary search tree (BST) and a positive integer k. In a BST, for any given node, all values in its left subtree are strictly smaller than the node's value, and all values in its right subtree are strictly larger. Every node holds a unique integer. Your task is to find and return the k-th smallest value among all nodes in the tree, using 1‑based indexing (the smallest element is considered the 1st, the next smallest is the 2nd, and so…