Linked List

  • Merge K Sorted Lists
    You are given an array of k linked lists, each linked list is sorted in ascending order. Merge all the linked lists into one sorted linked list and return it.
  • Middle of the Linked List
    Given a singly-linked list, find the middle node of the list. If the list contains an even number of nodes, return the second middle node.
  • Linked List Cycle II
    Given a linked list, determine if it contains a cycle. If a cycle is present, find the node where the cycle begins and return it. If there is no cycle, return nullptr.
  • Linked List Cycle
    Given a linked list, determine if it has a cycle in it. A cycle is when a node in the linked list points to a previously visited node, forming a loop. Return true if there is a cycle, otherwise, return false.
  • Reverse Nodes in k-Group
    Given the head of a singly linked list and an integer k, reverse the nodes…
  • Reverse Linked List II
    Given the head of a singly linked list and two integers left and right, reverse…
  • Rotate List
    Given the head of a singly linked list and an integer k, rotate the linked list to the right by k places. The rotation means moving the last k nodes to the front of the list.
  • Reverse Linked List
    Given the head of a singly linked list, reverse the list in-place and return the new head of the reversed linked list.
  • What is Linked List?
    A linked list is a fundamental data structure in computer science used for storing and organizing a collection of elements called nodes. Unlike arrays, which use contiguous memory, linked lists utilize non-contiguous memory and each node contains two parts: the data and a reference (pointer) to the next node in the sequence.