> ## 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>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 2 | [Add Two Numbers](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/partition-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/partition_list/solution.py) |
| 92 | [Reverse Linked List II](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/reorder-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reorder_list/solution.py) |
| 146 | [LRU Cache](https://leetcode-py.wisl.dev/problems/lru-cache) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lru_cache/solution.py) |
| 147 | [Insertion Sort List](https://leetcode-py.wisl.dev/problems/insertion-sort-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insertion_sort_list/solution.py) |
| 148 | [Sort List](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/design-twitter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_twitter/solution.py) |
| 369 | [Plus One Linked List](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/lfu-cache) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lfu_cache/solution.py) |
| 622 | [Design Circular Queue](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/design-circular-deque) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_circular_deque/solution.py) |
| 705 | [Design HashSet](https://leetcode-py.wisl.dev/problems/design-hash-set) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_hash_set/solution.py) |
| 706 | [Design HashMap](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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) |


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