Insert a node at the head of a linked list

  • + 2 comments

    Here C# solution have some issue. Same code base from python, is working fine.

    Python

    def insertNodeAtHead(llist, data):
        # Write your code here
        head =  SinglyLinkedListNode (data)
        head.next = llist
        return head
    

    C#

    static SinglyLinkedListNode insertNodeAtHead(SinglyLinkedListNode llist, int data) {
    	var head = new SinglyLinkedListNode(data);
    	head.next = llist;
    	return head;
    }