@@ -0,0 +1,1255 @@
+package FindAllNumbersDisappearedinanArray;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Given an array of integers where 1 %E2%89%A4 a%5Bi%5D %E2%89%A4 n (n = size of array), some elements appear twice and%0A * others appear once.%0A *%0A * Find all the elements of %5B1, n%5D inclusive that do not appear in this array.%0A *%0A * Could you do it without extra space and in O(n) runtime? You may assume the returned list does%0A * not count as extra space.%0A *%0A * Example:%0A * %3Cpre%3E%0A * Input:%0A * %5B4,3,2,7,8,2,3,1%5D%0A *%0A * Output:%0A * %5B5,6%5D%0A * %3C/pre%3E%0A */%0Apublic class Solution %7B%0A%0A    private int locationOf(int v) %7B%0A        return v - 1;%0A    %7D%0A%0A    public List%3CInteger%3E findDisappearedNumbers(int%5B%5D nums) %7B%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            int n = nums%5Bi%5D;%0A            while (true) %7B%0A                int l = locationOf(n);%0A                if (nums%5Bl%5D == n) break;%0A                int t = nums%5Bl%5D;%0A                nums%5Bl%5D = n;%0A                n = t;%0A                if (l == i) break;%0A            %7D%0A        %7D%0A        List%3CInteger%3E disappeared = new ArrayList%3C%3E();%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            if (locationOf(nums%5Bi%5D) != i) %7B%0A                disappeared.add(i + 1);%0A            %7D%0A        %7D%0A        return disappeared;%0A    %7D%0A%7D

448. Find All Numbers Disappeared in an Array