Sort by

recency

|

1211 Discussions

|

  • + 0 comments

    can you help me to integrate this script into my business setup website , i want to use this on my wordpress website

  • + 0 comments

    solution with JS

    function findMergeNode(headA, headB) {
       let current1 = headA;
        let current2 = headB;
    
        let length1 = 0;
        let length2 = 0;
    
        while (current1) {
            length1++;
            current1 = current1.next;
        }
    
        while (current2) {
            length2++;
            current2 = current2.next;
        }
    
        current1 = headA;
        current2 = headB;
    
        if (length1 > length2) {
            for (let i = 0; i < length1 - length2; i++) {
                current1 = current1.next;
            }
        } else if (length2 > length1) {
            for (let i = 0; i < length2 - length1; i++) {
                current2 = current2.next;
            }
        }
    
        while (current1 && current2) {
            if (current1 === current2) {
                return current1.data; 
            }
            current1 = current1.next;
            current2 = current2.next;
        }
    
        return null; 
    }
    
  • + 0 comments

    I also face this problem with my mod editor website. Do not read any input from stdin/console is what the instructions indicate, yet the code editor says the exact opposite.

  • + 0 comments

    Python Code

    def findMergeNode(head1, head2):
        l1, l2 = head1, head2
        dummy = {}
        while l1:
            dummy[id(l1)] = l1.data
            l1=l1.next
        while l2:
            if id(l2) in dummy:
                return dummy[id(l2)]
            else:
                l2=l2.next
    
  • + 0 comments

    The given classes for C# do not compile. I hope they fix this.

    It would be nice to have sample input and output.