LinkedList

LeetCode - Flatten a Multilevel Doubly Linked List - Day5 (1/5/2020)

Flatten a Multilevel Doubly Linked List Question You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a separate doubly linked list. These chil…

LeetCode - Remove Nth Node From End of List - Day5 (1/5/2020)

Remove Nth Node From End of List Question Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked lis…

LeetCode - Merge two sorted lists - Day5 (1/5/2020)

Merge two sorted lists Question Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4 Solutio…

LeetCode - Linked List Cycle - Day5 (1/5/2020)

Linked List Cycle Question Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If…

LeetCode - Linked List Cycle II - Day5 (1/5/2020)

Linked List Cycle II Question Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in…