@@ -0,0 +1,1098 @@
+package leetcode;%0A%0A/**%0A * https://leetcode.com/problems/minimum-distance-between-bst-nodes/%0A */%0Apublic class Problem783 %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    public int minDiffInBST(TreeNode root) %7B%0A        Result result = new Result();%0A        inOrder(root, result);%0A        return result.min;%0A    %7D%0A%0A    private static class Result %7B%0A        private Integer min;%0A        private Integer value;%0A    %7D%0A%0A    private static void inOrder(TreeNode root, Result result) %7B%0A        if (root == null) %7B%0A            return;%0A        %7D%0A        inOrder(root.left, result);%0A        if (result.value == null) %7B%0A            result.value = root.val;%0A        %7D else %7B%0A            int diff = Math.abs(result.value - root.val);%0A            if (result.min == null) %7B%0A                result.min = diff;%0A            %7D else %7B%0A                result.min = Math.min(result.min, diff);%0A            %7D%0A            result.value = root.val;%0A        %7D%0A        inOrder(root.right, result);%0A    %7D%0A%7D%0A

Solve problem 783