网友收藏判断链表是否有环-CSDN博客文章浏览阅读33次。public static boolean hasCycle(ListNode head){ if(head==null||head.next==null) return false; ListNode slow=head; ListNode fast=head.next; while(slow!=fast) { if(fast==null||fast.next==null...... 2024-01-23 15:08 评论 0 阅读 阅读全文