Problem 2.1: Remove Duplicates (100 pts)
Write a function remove_duplicates
which takes in a sorted linked list of integers and mutates it so that all duplicates are removed.
Your implementation should mutate the original linked list. DO NOT create any new linked lists and DO NOT return the modified Link object.
def remove_duplicates(lnk):
""" Remove all duplicates in a sorted linked list.
>>> lnk = Link(1, Link(1, Link(1, Link(1, Link(5)))))
>>> Link.__init__, hold = lambda *args: print("Do not steal chicken!"), Link.__init__
>>> try:
... remove_duplicates(lnk)
... finally:
... Link.__init__ = hold
>>> lnk
Link(1, Link(5))
"""
"*** YOUR CODE HERE ***"