Remove Duplicates from Sorted List II @ LeetCode (Python)
kitt
posted @ 2014年4月14日 20:06
in LeetCode
, 2415 阅读
# class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def deleteDuplicates(self, head): if head == None: return None dummy = ListNode(10**10) dummy.next, head = head, dummy # add a dummy node pprev, prev, curr, dupFlag = head, head.next, head.next.next, False while True: if dupFlag == True: if curr == None: pprev.next = None break if prev.val != curr.val: pprev.next, prev, dupFlag = curr, curr, False else: if curr == None: break if prev.val == curr.val: dupFlag = True else: pprev, prev = pprev.next, prev.next curr = curr.next return head.next # remove dummy
2021年9月01日 03:59
The task of being a parent involves coping with lots associated with mess. Moms (particularly housewives) tend to be mostly in the center of messy work. Sometimes they're found wiping their own sticky fingers along with other times they're sorting via mental hardship. For all of them, the heart and soul of calmness for some time tends to become painfully incredibly elusive. For all of them, standard home cleaning services tend to be nothing under a great asset. The moods associated with moms happen to be observed to alter for the greater, once their own household cleansing work accomplishes.
2024年1月30日 07:53
By using relatives visiting for any holidays your home becoming a warm fun space, what improved time as compared with now to undertake some family vacation cleaning? But the holidays are inclined to bring young families together, your house is required to be as ready because you are! Whether you are attempting make space while in the guest room's dresser doors or have got a more efficient space for your personal family.
2024年1月31日 08:29
Although there are several finishing options around the metal fabrication industry, talc coating is definitely relatively innovative. Prior to that technology, most metal appeared to be painted - but it surely was determined that paint could not bond actually to stainless steel fabricated merchandise, and you could possibly only put a great deal of paint for a product in advance of it hit maximum size.