Insert a node at the head of a linked list

Sort by

recency

|

978 Discussions

|

  • + 0 comments

    What others already mentioned. C#'s main has code copy-pasta from C++ and is not a valid C# code, so can't build in C#.

    So much for hacker ranking and leet coding :lol:

  • + 0 comments

    Here is my c++ solution you watch vide explanation here : https://youtu.be/COnfpdhOlN8

    SinglyLinkedListNode* insertNodeAtHead(SinglyLinkedListNode* llist, int data) {
       SinglyLinkedListNode* new_node = new SinglyLinkedListNode(data);
       new_node -> next = llist;
       return new_node;
    }
    
  • + 0 comments

    SinglyLinkedListNode* insertNodeAtHead(SinglyLinkedListNode* head, int val) { SinglyLinkedListNode* temp = new SinglyLinkedListNode(val); temp->next = head; return temp; }

  • + 0 comments

    c# Main() method is broken, cannot fix it it is locked for editing.

  • + 0 comments

    The c# method has error here :: PrintSinglyLinkedList(llist->head, "\n", textWriter);

    The -> operator is not allowed c# (pointer only for c/c++).

    Use another compiler.