Member-only story
Remove Nth Node from the Back of the Linked List | Linked List | Coding Interview
I can think of two ways to solve this problem; one using a stack and another without a stack. The time complexity will be the same in both cases, and the space requirement is linear in the stack approach and constant in the iterative one. Let’s see how.
I have been writing detailed articles on interview problems for quite some time; I would like you to read and get help from this pattern-wise list 🔥 of problems.
Table of Contents
Description
Given a linked list with a pointer to its head and an integer n. Delete the nth node from the back of the linked list.
Suppose we have a linked list with the following nodes, and we want to delete the 9th from behind, which is holding “F.”