Sort by

recency

|

905 Discussions

|

  • + 0 comments

    Here is my c++ solution, you can watch video explanation here : https://youtu.be/F4nGusqPIu0

    SinglyLinkedListNode* reverse(SinglyLinkedListNode* llist) {
        SinglyLinkedListNode* reverse = nullptr;
        while(llist != nullptr){
            SinglyLinkedListNode* newNode = new SinglyLinkedListNode(llist->data);
            newNode ->next = reverse;
            reverse = newNode;
            llist = llist->next;
        }
        return reverse;
    }
    
  • + 0 comments

    reverse, stack, current = SinglyLinkedList(), [], llist while current: stack.append(current.data) current = current.next while stack: reverse.insert_node(stack.pop()) return reverse.head

  • + 0 comments

    JAVA syntex is wrong in starting code.

    comment out line 55 : class Result { and one closing parenthesis before writing code

  • + 0 comments

    Fourth broken C# template.

    Remove class result but keep its guts. make reverse function non-public (remove public keyword).

    Geeze hackerrank -- didn't expect it that bad. And you guys test for our ability to program?

  • + 0 comments

    Cannot be solved via c#, its broken. Fields for the node needs to be changed to nullable.