"""Definition of ListNodeclass ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next"""classSolution:""" @param head: A ListNode @return: A ListNode """defdeleteDuplicates(self,head):# write your code hereifhead==Noneorhead.next==None:returnheadfast_node=headslow_node=headwhilefast_node!=None:iffast_node==slow_node:fast_node=fast_node.nextelse:slow_node.next=fast_nodeslow_node=fast_nodefast_node=fast_node.next# terminate the result# 1->2->3->3->Noneslow_node.next=Nonereturnhead