@@ -0,0 +1,953 @@
+package leetcode;%0A%0A/**%0A * https://leetcode.com/problems/kth-smallest-element-in-a-bst/%0A */%0Apublic class Problem230 %7B%0A    public static class TreeNode %7B%0A        int val;%0A        TreeNode left;%0A        TreeNode right;%0A%0A        TreeNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A%0A    private static class Result %7B%0A        int n;%0A        int val;%0A        boolean found;%0A    %7D%0A    %0A    public int kthSmallest(TreeNode root, int k) %7B%0A        Result result = new Result();%0A        kthSmallest(root, k, result);%0A        return result.val;%0A    %7D%0A    %0A    private void kthSmallest(TreeNode node, int k, Result result) %7B%0A        if (result.n == k) %7B%0A            result.found = true;%0A            return;%0A        %7D%0A        if (node == null) %7B%0A            return;%0A        %7D%0A        kthSmallest(node.left, k, result);%0A        result.n++;%0A        if (!result.found) %7B%0A            result.val = node.val;%0A        %7D%0A        kthSmallest(node.right, k, result);%0A    %7D%0A%7D%0A

Solve problem 230