判断给定的链表中是否有环.如果有环则返回true,否则返回false. 解题思路:设置两个指针,slow和fast,fast每次走两步,slow每次走一步,如果有环的话fast一定会追上slow,判断fast==slow或者fast.next==slow即可判断 class ListNode { int val; ListNode next; ListNode(int x) { val = x; next = null; } } public class test1 { public boole…