Skip to content

Commit 3693ece

Browse files
author
刘勋
committed
环形链表 II
1 parent 1605b8f commit 3693ece

File tree

1 file changed

+1
-0
lines changed
  • src/main/java/com/algorithm/study/demo/algorithm/leetcode

1 file changed

+1
-0
lines changed

src/main/java/com/algorithm/study/demo/algorithm/leetcode/Solution7.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static ListNode detectCycle(ListNode head) {
4646
break;
4747
}
4848
}
49+
//如果快慢指针没有相遇代表是无环链表
4950
if (p1!=p2){
5051
return null;
5152
}

0 commit comments

Comments
 (0)