Linked List Cycle
来源:互联网 发布:棋牌游戏透视软件 编辑:程序博客网 时间:2024/05/16 17:05
/** * Definition for singly-linked list. * class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */public class Solution { public boolean hasCycle(ListNode head) { if (head == null || head.next == null) { return false; } ListNode sn = head, fn = head.next; while (fn != null && fn.next != null) { if (fn == sn) { return true; } sn = sn.next; fn = fn.next.next; } return false; }}
0 0
- leetcode Linked List Cycle & Linked List Cycle ||
- Linked List Cycle II Linked List Cycle
- 【LeetCode】Linked List Cycle
- Leetcode: Linked List Cycle
- Leetcode Linked List Cycle
- Linked List Cycle
- Linked List Cycle II
- Linked List Cycle
- Linked List Cycle
- Linked List Cycle II
- Leetcode: Linked List Cycle
- LeetCode:Linked List Cycle
- Linked List Cycle II
- Linked List Cycle
- Linked List Cycle II
- [LeetCode]Linked List Cycle
- Linked List Cycle
- LeetCode | Linked List Cycle
- kthread schedule
- matlab-高数 无穷级数求和
- JAVA中 重写与重载需要注意的地方
- leetcode-java-338. Counting Bits
- 《JAVA与模式》之单例模式
- Linked List Cycle
- 玩转京东暨618狂欢节回顾
- JavaScript中Function类型
- matlab-高数 微分方程求解
- 从苏宁电器到卡巴斯基第05篇:我在佳木斯的日子(上)
- HDu 2044一只小蜜蜂...
- 必读资料
- LPDMvvmKit 源码学习笔记-01
- Win 10安装Python及环境变量配置