You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of the linked list formed after inserting this new node. The given head pointer may be null, meaning that the initial list is empty.

Input Format

You have to complete the SinglyLinkedListNode insertAtTail(SinglyLinkedListNode head, int data) method. It takes two arguments: the head of the linked list and the integer to insert at the tail.

Explanation

This is a classic Linked List Node realization below

"""Linked List Realization"""

	class SinglyLinkedListNode:
	    def __init__(self, node_data):
	        self.data = node_data
	        self.next = None

#python #linked-lists #problem-solving #hackerrank #data-structures

Insert a Node at the Tail of a Linked List. HackerRank Exercise
2.20 GEEK