> ## Documentation Index
> Fetch the complete documentation index at: https://leetcode-py.wisl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.
> Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.
> Examples are backed by tests; copy them verbatim.

# Linked List in Python with Tests

> All 61 Linked List LeetCode problems with tested Python solutions.

Linked List holds 61 problems (11 Easy, 45 Medium, 5 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

<div className="sd-catalog-table">
  | # | Problem | Difficulty | Solution |
  | - | - | - | - |
  | 2 | [Add Two Numbers](/problems/add-two-numbers) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/add_two_numbers/solution.py) |
  | 19 | [Remove Nth Node From End of List](/problems/remove-nth-node-from-end-of-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_nth_node_from_end_of_list/solution.py) |
  | 21 | [Merge Two Sorted Lists](/problems/merge-two-sorted-lists) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/merge_two_sorted_lists/solution.py) |
  | 23 | [Merge k Sorted Lists](/problems/merge-k-sorted-lists) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/merge_k_sorted_lists/solution.py) |
  | 24 | [Swap Nodes in Pairs](/problems/swap-nodes-in-pairs) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/swap_nodes_in_pairs/solution.py) |
  | 25 | [Reverse Nodes in k-Group](/problems/reverse-nodes-in-k-group) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_nodes_in_k_group/solution.py) |
  | 61 | [Rotate List](/problems/rotate-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rotate_list/solution.py) |
  | 82 | [Remove Duplicates from Sorted List II](/problems/remove-duplicates-from-sorted-list-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_duplicates_from_sorted_list_ii/solution.py) |
  | 83 | [Remove Duplicates from Sorted List](/problems/remove-duplicates-from-sorted-list) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_duplicates_from_sorted_list/solution.py) |
  | 86 | [Partition List](/problems/partition-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/partition_list/solution.py) |
  | 92 | [Reverse Linked List II](/problems/reverse-linked-list-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_linked_list_ii/solution.py) |
  | 109 | [Convert Sorted List to Binary Search Tree](/problems/convert-sorted-list-to-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_sorted_list_to_binary_search_tree/solution.py) |
  | 114 | [Flatten Binary Tree to Linked List](/problems/flatten-binary-tree-to-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_binary_tree_to_linked_list/solution.py) |
  | 116 | [Populating Next Right Pointers In Each Node](/problems/populating-next-right-pointers-in-each-node) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/populating_next_right_pointers_in_each_node/solution.py) |
  | 117 | [Populating Next Right Pointers in Each Node II](/problems/populating-next-right-pointers-in-each-node-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/populating_next_right_pointers_in_each_node_ii/solution.py) |
  | 138 | [Copy List with Random Pointer](/problems/copy-list-with-random-pointer) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/copy_list_with_random_pointer/solution.py) |
  | 141 | [Linked List Cycle](/problems/linked-list-cycle) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_cycle/solution.py) |
  | 142 | [Linked List Cycle II](/problems/linked-list-cycle-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_cycle_ii/solution.py) |
  | 143 | [Reorder List](/problems/reorder-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reorder_list/solution.py) |
  | 146 | [LRU Cache](/problems/lru-cache) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lru_cache/solution.py) |
  | 147 | [Insertion Sort List](/problems/insertion-sort-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insertion_sort_list/solution.py) |
  | 148 | [Sort List](/problems/sort-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sort_list/solution.py) |
  | 160 | [Intersection of Two Linked Lists](/problems/intersection-of-two-linked-lists) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/intersection_of_two_linked_lists/solution.py) |
  | 203 | [Remove Linked List Elements](/problems/remove-linked-list-elements) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_linked_list_elements/solution.py) |
  | 206 | [Reverse Linked List](/problems/reverse-linked-list) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_linked_list/solution.py) |
  | 234 | [Palindrome Linked List](/problems/palindrome-linked-list) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/palindrome_linked_list/solution.py) |
  | 237 | [Delete Node in a Linked List](/problems/delete-node-in-a-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_node_in_a_linked_list/solution.py) |
  | 328 | [Odd Even Linked List](/problems/odd-even-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/odd_even_linked_list/solution.py) |
  | 355 | [Design Twitter](/problems/design-twitter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_twitter/solution.py) |
  | 369 | [Plus One Linked List](/problems/plus-one-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/plus_one_linked_list/solution.py) |
  | 379 | [Design Phone Directory](/problems/design-phone-directory) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_phone_directory/solution.py) |
  | 382 | [Linked List Random Node](/problems/linked-list-random-node) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_random_node/solution.py) |
  | 426 | [Convert Binary Search Tree to Sorted Doubly Linked List](/problems/convert-binary-search-tree-to-sorted-doubly-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_binary_search_tree_to_sorted_doubly_linked_list/solution.py) |
  | 430 | [Flatten a Multilevel Doubly Linked List](/problems/flatten-a-multilevel-doubly-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_a_multilevel_doubly_linked_list/solution.py) |
  | 432 | [All O\`one Data Structure](/problems/all-oone-data-structure) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/all_oone_data_structure/solution.py) |
  | 445 | [Add Two Numbers II](/problems/add-two-numbers-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/add_two_numbers_ii/solution.py) |
  | 460 | [LFU Cache](/problems/lfu-cache) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lfu_cache/solution.py) |
  | 622 | [Design Circular Queue](/problems/design-circular-queue) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_circular_queue/solution.py) |
  | 641 | [Design Circular Deque](/problems/design-circular-deque) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_circular_deque/solution.py) |
  | 705 | [Design HashSet](/problems/design-hash-set) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_hash_set/solution.py) |
  | 706 | [Design HashMap](/problems/design-hash-map) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_hash_map/solution.py) |
  | 707 | [Design Linked List](/problems/design-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_linked_list/solution.py) |
  | 708 | [Insert into a Sorted Circular Linked List](/problems/insert-into-a-sorted-circular-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insert_into_a_sorted_circular_linked_list/solution.py) |
  | 716 | [Max Stack](/problems/max-stack) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_stack/solution.py) |
  | 725 | [Split Linked List in Parts](/problems/split-linked-list-in-parts) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_linked_list_in_parts/solution.py) |
  | 817 | [Linked List Components](/problems/linked-list-components) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_components/solution.py) |
  | 876 | [Middle of the Linked List](/problems/middle-of-the-linked-list) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/middle_of_the_linked_list/solution.py) |
  | 1265 | [Print Immutable Linked List in Reverse](/problems/print-immutable-linked-list-in-reverse) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/print_immutable_linked_list_in_reverse/solution.py) |
  | 1367 | [Linked List in Binary Tree](/problems/linked-list-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_in_binary_tree/solution.py) |
  | 1472 | [Design Browser History](/problems/design-browser-history) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_browser_history/solution.py) |
  | 1474 | [Delete N Nodes After M Nodes of a Linked List](/problems/delete-n-nodes-after-m-nodes-of-a-linked-list) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_n_nodes_after_m_nodes_of_a_linked_list/solution.py) |
  | 1669 | [Merge In Between Linked Lists](/problems/merge-in-between-linked-lists) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/merge_in_between_linked_lists/solution.py) |
  | 1721 | [Swapping Nodes in a Linked List](/problems/swapping-nodes-in-a-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/swapping_nodes_in_a_linked_list/solution.py) |
  | 1836 | [Remove Duplicates From an Unsorted Linked List](/problems/remove-duplicates-from-an-unsorted-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_duplicates_from_an_unsorted_linked_list/solution.py) |
  | 2058 | [Find the Minimum and Maximum Number of Nodes Between Critical Points](/problems/find-the-minimum-and-maximum-number-of-nodes-between-critical-points) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_minimum_and_maximum_number_of_nodes_between_critical_points/solution.py) |
  | 2130 | [Maximum Twin Sum of a Linked List](/problems/maximum-twin-sum-of-a-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_twin_sum_of_a_linked_list/solution.py) |
  | 2181 | [Merge Nodes in Between Zeros](/problems/merge-nodes-in-between-zeros) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/merge_nodes_in_between_zeros/solution.py) |
  | 2326 | [Spiral Matrix IV](/problems/spiral-matrix-iv) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/spiral_matrix_iv/solution.py) |
  | 2487 | [Remove Nodes From Linked List](/problems/remove-nodes-from-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_nodes_from_linked_list/solution.py) |
  | 2807 | [Insert Greatest Common Divisors in Linked List](/problems/insert-greatest-common-divisors-in-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insert_greatest_common_divisors_in_linked_list/solution.py) |
  | 3217 | [Delete Nodes From Linked List Present in Array](/problems/delete-nodes-from-linked-list-present-in-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_nodes_from_linked_list_present_in_array/solution.py) |
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.