/**
* @Description 没啥说的,就是遍历链表并剔除重复元素
* 卑微的一天从简单题开始
* @Date 2022/1/17 9:54 下午
* @Author wuqichuan@zuoyebang.com
**/
public class Solution {
public ListNode deleteDuplicates(ListNode head) {
ListNode cur = head;
while (cur != null && cur.next != null){
ListNode next = cur.next;
if(cur.val == next.val){
cur.next = next.next;
}else {
cur = cur.next;
}
}
return head;
}
}