Skip to content

Commit f905872

Browse files
authored
Update 019_Remove_Nth_Node_From_End_of_List.py
1 parent 016b7e6 commit f905872

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/019_Remove_Nth_Node_From_End_of_List.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class Solution(object):
3333

3434
def removeNthFromEnd(self, head, n):
3535
# https://leetcode.com/discuss/86721/o-n-solution-in-java
36+
#http://bangbingsyb.blogspot.com/2014/11/leetcode-remove-nth-node-from-end-of.html
37+
#
3638
if head is None:
3739
return None
3840
slow = fast = head
@@ -41,7 +43,7 @@ def removeNthFromEnd(self, head, n):
4143
if fast is None:
4244
head = head.next
4345
return head
44-
while fast.next is not None:
46+
while fast.next is not None: # while not fast.next does not work
4547
fast = fast.next
4648
slow = slow.next
4749
curr = slow.next

0 commit comments

Comments
 (0)