Linked List 8: Nth node from end of the Linked list | Must Do Coding Questions | GeeksForGeeks

Опубликовано: 03 Апрель 2026
на канале: Krishna Teaches
3,992
93

This video contains Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …
from geeksforgeeks platform.

website link:
https://www.geeksforgeeks.org/must-do...

Topics covered in this video series are:
1.Arrays
   • 1.1 ARRAYS | Must Do Coding Questions  
2.String
   • 1.2 STRING | Must Do Coding Questions  
3.Linked List
   • 1.3 LINKED LIST | Must Do Coding Questions  
4.Stack and Queue
5.Tree and BST
6.Heap
7.Recursion
8.Hashing
9.Graph
10.Greedy
11.Dynamic Programming
12.Divide and Conquer
13.Backtracking
14.Bit Magic

Linked List:
8. Nth node from end of linked list :
Given a linked list consisting of L nodes and given a number N. The task is to find the Nth node from the end of the linked list.

Example 1:
Input:
N = 2
LinkedList: 1--2--3--4--5--6--7--8--9
Output: 8
Explanation: In the first example, there are 9 nodes in linked list and we need to find 2nd node from end. 2nd node from end os 8.

Example 2:
Input:
N = 5
LinkedList: 10--5--100--5
Output: -1
Explanation: In the second example, there are 4 nodes in the linked list and we need to find 5th from the end. Since 'n' is more than the number of nodes in the linked list, the output is -1.

Code Link:
https://github.com/krishna-gavas/Comp...

Intro Music :
   • Video  p