解题思路:
class Solution {
List<Integer> list = new ArrayList<>();
public int kthSmallest(TreeNode root, int k) {
dfs(root);
return list.get(k - 1);
}
public void dfs(TreeNode root) {
if (root == null) return;
dfs(root.left);
list.add(root.val);
dfs(root.right);
}
}