首页 > 编程语言 > 详细

每日LeetCode - 83. 删除排序链表中的重复元素(C语言)

时间:2021-05-20 22:26:18      阅读:23      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

C语言

struct ListNode {
      int val;
      struct ListNode *next;
 };
 
struct ListNode* deleteDuplicates(struct ListNode* head){
    struct ListNode* cur = head;
    if (head) {
        while (cur->next) {
            if (cur->val == cur->next->val) 
                cur->next = cur->next->next;
            else 
                cur = cur->next;
        }
    }
    return head;
}

 

每日LeetCode - 83. 删除排序链表中的重复元素(C语言)

原文:https://www.cnblogs.com/vicky2021/p/14791111.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!