https://leetcode.com/problems/linked-list-cycle/description/ Easy

Решение

class Solution {
    fun hasCycle(head: ListNode?): Boolean {
        var slow = head
        var fast = head
        while (fast != null) {
            val f1 = fast.next ?: return false
            fast = f1.next
            slow = slow?.next
            if (slow === fast) return true
        }
        return false
    }
}