Tagged

HackerRank

A collection of 19 posts

HackerRank Delete a Node from a Linked List | JS Solution
Linked Lists

HackerRank Delete a Node from a Linked List | JS Solution

ProblemHackerRank detailed problem description can be found here. Inputs & Outputs/* param {Node} head param {number} position return {Node} head */Test CaseInitial Linked ListResulting Linked ListJavaScript Solutionfunction deleteNode(head, position) { if (!head) { return null; } let nodeToDelete = head; if (position === 0) { head = nodeToDelete.next; return head; } let count = 0; let prev