Leetcode 83 刪除排序鏈表中的重複元素【鏈表】

本題是簡單的鏈表題。 1.思路 1)單指針,下一個和上一個相同,p.next指向p.next.next,否則p指針後移 這裏不用啞節點,直接開始就判斷 2.代碼 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None clas
相關文章
相關標籤/搜索