@@ -0,0 +1,636 @@
+import java.util.Set;%0Aimport java.util.TreeSet;%0A%0Aimport sun.reflect.generics.tree.Tree;%0A%0Aclass Solution %7B%0A    public boolean containsNearbyAlmostDuplicate(int%5B%5D nums, int k, int t) %7B%0A        TreeSet%3CLong%3E treeSet = new TreeSet%3C%3E();%0A%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            if (treeSet.ceiling((long)nums%5Bi%5D - t) != null && treeSet.ceiling((long)nums%5Bi%5D - t) %3C= (long)nums%5Bi%5D + t) %7B%0A                return true;%0A            %7D%0A%0A            treeSet.add((long)nums%5Bi%5D);%0A%0A            if (treeSet.size() == k + 1) %7B%0A                treeSet.remove((long)nums%5Bi - k%5D);%0A            %7D%0A        %7D%0A%0A        return false;%0A    %7D%0A%7D%0A

220. Contains Duplicate III