PROBLEM DESCRIPTION Given two numbers, num1, and num2, represented by linked lists. The task is to return the head of the linked list representing the sum of these two numbers. For example, the n...
Palindrome Linked List (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a singly linked list of integers. The task is to check if the given linked list is palindrome or not. geeksforgeeks SOLUTION To solve this, we can reverse the second h...
Detect Loop in linked list (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given the head of a singly linked list, the task is to check if the linked list has a loop. A loop means that the last node of the linked list is connected back to a node in th...
Remove loop in Linked List (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given the head of a linked list that may contain a loop. A loop means that the last node of the linked list is connected back to a node in the same list. So if the next of the ...
Pairwise swap elements of a linked list (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a singly linked list. The task is to swap elements in the linked list pairwise. For example, if the input list is 1 2 3 4, the resulting list after swaps will be 2 1 4 3....
Implement Stack using Linked List (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Let’s give it a try! You have a linked list and must implement the functionalities push and pop of stack using this given linked list. Your task is to use the class as shown in...
Sort a linked list of 0s, 1s and 2s (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a linked list where nodes can contain values 0s, 1s, and 2s only. The task is to segregate 0s, 1s, and 2s linked list such that all zeros segregate to the head side, 2s a...
Delete without head pointer (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION You are given a node del_node of a Singly Linked List where you have to delete a value of the given node from the linked list but you are not given the head of the list. geeks...
Reverse a linked list (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given the head of a linked list, the task is to reverse this list and return the reversed head. geeksforgeeks SOLUTION class Solution { Node reverseList(Node head) { ...
Middle of a Linked List (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given the head of a linked list, the task is to find the middle. For example, the middle of 1-> 2->3->4->5 is 3. If there are two middle nodes (even count), return ...