토요일 아침도 활기차게(?) 리트코드와 함께!
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]:
cur = head
while(cur):
while cur.next and cur.val == cur.next.val:
cur.next = cur.next.next
cur = cur.next
return head
오늘은 바쁘니(? 사실 안바쁨) 여기까지만 바잉
'Leetcode' 카테고리의 다른 글
129. Sum Root to Leaf Numbers (0) | 2021.11.03 |
---|---|
232. Implement Queue using Stacks (0) | 2021.11.02 |
Leetcode 226. Invert Binary Tree (0) | 2021.10.26 |
Leetcode 155. Min Stack (0) | 2021.10.25 |
Leetcode 380. Insert Delete GetRandom O(1) (0) | 2021.10.21 |