@@ -0,0 +1,591 @@
+/**%0A * Definition for a binary tree node.%0A * public class TreeNode %7B%0A *     int val;%0A *     TreeNode left;%0A *     TreeNode right;%0A *     TreeNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Aclass Solution %7B%0A  public int kthSmallest(TreeNode root, int k) %7B%0A    if (root == null) return -1; // invalid state%0A    int size = 1 + size(root.left);%0A    if (size == k) return root.val;%0A    if (size %3E k) return kthSmallest(root.left, k);%0A    return kthSmallest(root.right, k - size);%0A  %7D%0A%0A  private int size(TreeNode root) %7B%0A    if (root == null) return 0;%0A    return 1 + size(root.left) + size(root.right);%0A  %7D%0A%7D%0A

add solution for kth smallest in bst