Skip to content

Commit e146d73

Browse files
Merge pull request youngyangyang04#926 from Jerry-306/patch-46
更正 0019 删除链表中倒数第N个节点 JavaScript 代码
2 parents b282924 + 2789554 commit e146d73

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

problems/0019.删除链表的倒数第N个节点.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ var removeNthFromEnd = function(head, n) {
173173
let ret = new ListNode(0, head),
174174
slow = fast = ret;
175175
while(n--) fast = fast.next;
176-
if(!fast) return ret.next;
177-
while (fast.next) {
176+
while (fast.next !== null) {
178177
fast = fast.next;
179178
slow = slow.next
180179
};

0 commit comments

Comments
 (0)