def partition(self, head, x): smallhead = None bigequalhead = None real = None small = None while head != None: if head.val < x: if smallhead == None: smallhead = head small = head else: smallhead.next = head smallhead = head else: if bigequalhead == None: bigequalhead = head real = head else: bigequalhead.next = head bigequalhead = head head = head.next if small == None: return real smallhead.next = real return small
with input [2,1] 2 the judge says time limit exceeded. Have no clue. Thanks.
@themasterli I am facing the same problem. Did you figure out why?
@bruce01j I did not understand why i should put the tail.next = null
could you explain it to me ?
thanks a lot
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.