zoukankan      html  css  js  c++  java
  • 83.Remove Duplicates from Sorted List

    /**
     * Definition for singly-linked list.
     * struct ListNode {
     *     int val;
     *     ListNode *next;
     *     ListNode(int x) : val(x), next(NULL) {}
     * };
     */
    class Solution {
    public:
        ListNode* deleteDuplicates(ListNode* head) {
            ListNode *root=head;
            while(head!=NULL)
            {
                while(head->next!=NULL&&head->val==head->next->val)
                {
                    head->next=head->next->next;
                }
                head=head->next;
            }
            return root;
        }
    };
    
  • 相关阅读:
    python
    爬虫
    python 自动登录
    day22 cookie session 中间件 Form
    day10进程、异步IO、
    python第五课
    day21
    day20 Django
    day 19
    day18
  • 原文地址:https://www.cnblogs.com/smallredness/p/10676005.html
Copyright © 2011-2022 走看看