@@ -0,0 +1,1454 @@
+package main.algorithm.leetcode;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * Title : main.algorithm.leetcode %3Cbr%3E%0A * Description :%0A *   %3Cp%3E Runtime: 0 ms, faster than 100.00%25 of Java online submissions for Remove Duplicates from Sorted List.%0A *   %3Cp%3E Memory Usage: 36.1 MB, less than 99.96%25 of Java online submissions for Remove Duplicates from Sorted List.%0A * @author chile%0A * @version 1.0%0A * @date 2019/7/18 15:37%0A */%0Apublic class RemoveDuplicatesfromSortedList %7B%0A%0A    public class ListNode %7B%0A        int val;%0A%0A        ListNode next;%0A%0A        ListNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A%0A    class Solution %7B%0A        public ListNode deleteDuplicates(ListNode head) %7B%0A%0A            ListNode n = head;%0A            while (n != null) %7B%0A                if (n.next != null) %7B%0A                    if (n.val == n.next.val) %7B%0A                        n.next = n.next.next;%0A                    %7D else %7B%0A                        n = n.next;%0A                    %7D%0A                %7D else %7B%0A                    break;%0A                %7D%0A            %7D%0A%0A            return head;%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void test1() %7B%0A        ListNode head = new ListNode(1);%0A        ListNode n1 = new ListNode(2);%0A        ListNode n2 = new ListNode(2);%0A        head.next = n1;%0A        n1.next = n2;%0A        head = new Solution().deleteDuplicates(head);%0A        while (head != null) %7B%0A            System.out.println(head.val);%0A            head = head.next;%0A        %7D%0A    %7D%0A%0A%7D%0A

remove duplicates from sorted list