my O(1) space solution in Python

  • 0

    class Solution(object):

    def hasCycle(self, head):
        :type head: ListNode
        :rtype: bool
        if not head: return False
        while slow is not fast and fast and
        if slow is fast: return True
        return False

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.