You are viewing a single comment's thread. Return to all comments →
Updated python solution
def insertNodeAtPosition(llist, data, position): if llist is None: return SinglyLinkedListNode(data, None) current = llist for i in range(position): prev = current current = current.next Node = SinglyLinkedListNode(data) prev.next = Node Node.next = current return llist
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
Updated python solution