Welcome to the daily solving of our PROBLEM OF THE DAY with Saksham We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Linked List but also build up problem-solving skills.
Given a Singly Linked List, Delete all alternate nodes of the list ie delete all the nodes present in even positions.
Examples :
Input: LinkedList: 1->2->3->4->5->6
Output: 1->3->5
Explanation: Deleting alternate nodes ie 2, 4, 6 results in the linked list with elements 1->3->5.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/delete-alternate-nodes/1