Remove Duplicates from Sorted List II Solutions in PythonNumber 82Difficulty MediumAcceptance 36.9%Link LeetCodeOther languages C++, GoSolutionsPython solution by haoel/leetcodedef deleteDuplicates(self, head): dummy = prev = ListNode(0) dummy.next = head while head and head.next: if head.val == head.next.val: while head and head.next and head.val == head.next.val: head = head.next head = head.next prev.next = head else: prev = prev.next head = head.next return dummy.nextdef deleteDuplicates(self, head): dummy = prev = ListNode(0) dummy.next = head while head and head.next: if head.val == head.next.val: while head and head.next and head.val == head.next.val: head = head.next head = head.next prev.next = head else: prev = prev.next head = head.next return dummy.next