newszine

Reverse a Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list, write a program to reverse the linked list. Try to do it in-place by changing links between the nodes. Example  Input :- head = Output :- Input :- head = Read More

Remove Cycle from Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list if a linked list contains a cycle, then remove the cycle and return the same linked list. If there is no cycle, then return the same linked list. Note :- Cycle in the given linked list is represented by an integer position, which represents the position Read More

Find Length of Cycle in Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list, return the length of cycle in the linked list. If there is no cycle, then return 0. Note :- Cycle in the given linked list is represented by an integer position, which represents the position (0-indexed)  in the linked list where the cycle begins. If position Read More

Find Starting Node of Cycle in Linked List | Linked List Problem

4 years ago Lalit Bhagtani 1
Problem Statement You have given a singly linked list, return the node of the linked list where cycle begins. If there is no cycle, then return null. Note :- Cycle in the given linked list is represented by an integer position, which represents the position (0-indexed)  in the linked list where the cycle begins. If Read More

Cycle in Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list, find out if it contains a cycle or not. Example  Input :- head = , Cycle at 3rd Node Output :- true Input :- head = , No Cycle Output :- false Solution Floyd’s Cycle-Finding Read More

Middle of the Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list, return the middle node of a given linked list. Example  Input :- head = Output :- 10 Input :- head = Output :- 15 Solution Create two variables fast and slow, then move both Read More

Remove Nodes from Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list and an integer value, remove all nodes from a given linked list, whose value is equal to a given integer value. Example  Input :- head = , node = 4 Output :- Input :- head = Read More

Delete a Node in Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a node of the singly linked list, write a program to delete the given node. Note :- Given node will not be a tail of singly linked list. Example  Input :- head = , node = 4 Output :- Input :- Read More