• + 0 comments

    Hacky solution for the lulz:

    def has_cycle(head):
        c = 0
        while head:
            head = head.next
            c += 1
            if c > 1000:
                return 1
        return 0