Sort by

recency

|

1341 Discussions

|

  • + 0 comments

    This is not a well written problem. This is bad.

  • + 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
    
  • + 0 comments
     if head is None:
            return False
        
        slow = fast = head
        
        while fast is not None and fast.next is not None:
            slow = slow.next
            fast = fast.next.next
            
            if slow == fast:
                return True
        return False
    
  • + 0 comments

    in Typescript most of the required starting code is not there

  • + 1 comment

    The challenge is broken in JavaScript. The temp var. in the main function should be let instead of const, so it can be reassigned.