Singly Linkedlist Leetcode Problems
Singly Linkedlist Leetcode Problems
SL Problems
No-
1 206. Reverse Linked List :
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Linkedin
Linked List (C++)
1. Create a Singly Linked List in C++ and perform the following operations.
Insert elements in the beginning
Insert elements at the end.
Insert elements in between
Insert elements after an element (using value).
Insert elements after an element (using index).
2. Create a Singly Linked List in C++ and perform the following operations.
Delete elements from the beginning
Delete elements from the end.
Delete elements at position.
Leetcode Problems:
1. Iterative approach :
2. Recursive Approach:
876. Middle of the Linked List :
2. Recursive solution:
NOTE : There can be more than two duplicates so if we get the duplicate elements,
we have to compare the next elements with current elements so we are calling
deleteDuplicates(head) in the if condition.
First approach:
3. Using two pointers
160. Intersection of Two Linked Lists
203. Remove Linked List Elements
82. Remove Duplicates from Sorted List II
Linkedin
1721. Swapping Nodes in a Linked List
328. Odd Even Linked List
Linkedin
24. Swap Nodes in Pairs
25. Reverse Nodes in k-Group
142. Linked List Cycle II
725. Split Linked List in Parts
Merge k Sorted Lists
Linkedin
138. Copy List with Random Pointer