--
程式碼
應該不會算無意義文字吧
雖然我覺得我的程式碼真的很沒有意義==
def modifiedList(self, nums: List[int], head: Optional[ListNode]) ->
Optional[ListNode]:
nums = set(n for n in nums)
dummy = ListNode(0, next=head)
pre = dummy
cur = head
while cur:
if cur.val in nums:
pre.next = cur.next
cur = cur.next
else:
pre = cur
cur = cur.next
return dummy.next