@@ -0,0 +1,904 @@
+import org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * https://leetcode.com/problems/remove-element/%0A */%0Apublic class Solution %7B%0A    public int removeElement(int%5B%5D nums, int val) %7B%0A        int insertAt = -1;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            if (insertAt == -1 && nums%5Bi%5D == val) %7B%0A                insertAt = i;%0A            %7D%0A            if (insertAt != -1 && nums%5Bi%5D != val) %7B%0A                nums%5BinsertAt%5D = nums%5Bi%5D;%0A                insertAt++;%0A            %7D%0A        %7D%0A        return insertAt == -1 ? nums.length : insertAt;%0A    %7D%0A%0A    @Test%0A    public void test() %7B%0A        int%5B%5D nums = new int%5B%5D%7B3, 2, 2, 3%7D;%0A        int length = removeElement(nums, 3);%0A        assertEquals(2, length);%0A    %7D%0A%0A    @Test%0A    public void test1() %7B%0A        int%5B%5D nums = new int%5B%5D%7B2%7D;%0A        int length = removeElement(nums, 3);%0A        assertEquals(1, length);%0A    %7D%0A%7D%0A

Remove Element