# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def deleteDuplicates(self, head): crt=head while crt and crt.next: if crt.next.val==crt.val: crt.next=crt.next.next else: crt=crt.next return head
Sunday, September 7, 2014
Leetcode: Remove Duplicates from Sorted List @Python
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment