第一反应是遍历链表,将历史节点存放在map中(hash),遍历过程发现历史数据包含当前节点,则判断为有环: 1、历史节点法: package main import . "nc_tools" /* * type ListNode struct{ * Val int * Next *ListNode * } */ /** * * @param head ListNode类 * @return bool布尔型 */ func hasCycle( head *ListNode ) bool { // write code here contains :=...