[Leetcode 230] - Kth Smallest Element in a BST w/ Python
Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. 이진 탐색 트리가 주어졌을때 트리에서 k 번째 작은 숫자를 리턴하는 문제 https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/ Example 1: Input: root = [3,1,4,null,2], k = 1 Output: 1 Example 2: Input: root = [5,3,6,2,4,null,null,1], k = 3 Output: 3 이진 탐색 트리인 만큼 중위 순..
2024. 4. 10.