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

# Design in Python with Tests

> All 76 Design LeetCode problems with tested Python solutions.

Design holds 76 problems (13 Easy, 48 Medium, 15 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

<div className="sd-catalog-table">
  | # | Problem | Difficulty | Solution |
  | - | - | - | - |
  | 146 | [LRU Cache](/problems/lru-cache) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lru_cache/solution.py) |
  | 155 | [Min Stack](/problems/min-stack) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/min_stack/solution.py) |
  | 170 | [Two Sum III - Data structure design](/problems/two-sum-iii-data-structure-design) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/two_sum_iii_data_structure_design/solution.py) |
  | 173 | [Binary Search Tree Iterator](/problems/binary-search-tree-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_search_tree_iterator/solution.py) |
  | 208 | [Implement Trie (Prefix Tree)](/problems/implement-trie-prefix-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/implement_trie_prefix_tree/solution.py) |
  | 211 | [Design Add and Search Words Data Structure](/problems/design-add-and-search-words-data-structure) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_add_and_search_words_data_structure/solution.py) |
  | 225 | [Implement Stack using Queues](/problems/implement-stack-using-queues) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/implement_stack_using_queues/solution.py) |
  | 232 | [Implement Queue using Stacks](/problems/implement-queue-using-stacks) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/implement_queue_using_stacks/solution.py) |
  | 244 | [Shortest Word Distance II](/problems/shortest-word-distance-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_word_distance_ii/solution.py) |
  | 251 | [Flatten 2D Vector](/problems/flatten-2d-vector) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_2d_vector/solution.py) |
  | 271 | [Encode and Decode Strings](/problems/encode-and-decode-strings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/encode_and_decode_strings/solution.py) |
  | 281 | [Zigzag Iterator](/problems/zigzag-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/zigzag_iterator/solution.py) |
  | 284 | [Peeking Iterator](/problems/peeking-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/peeking_iterator/solution.py) |
  | 288 | [Unique Word Abbreviation](/problems/unique-word-abbreviation) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_word_abbreviation/solution.py) |
  | 295 | [Find Median from Data Stream](/problems/find-median-from-data-stream) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_median_from_data_stream/solution.py) |
  | 297 | [Serialize and Deserialize Binary Tree](/problems/serialize-and-deserialize-binary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/serialize_and_deserialize_binary_tree/solution.py) |
  | 303 | [Range Sum Query - Immutable](/problems/range-sum-query-immutable) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_query_immutable/solution.py) |
  | 304 | [Range Sum Query 2D - Immutable](/problems/range-sum-query-2d-immutable) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_query_2d_immutable/solution.py) |
  | 307 | [Range Sum Query - Mutable](/problems/range-sum-query-mutable) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_query_mutable/solution.py) |
  | 308 | [Range Sum Query 2D - Mutable](/problems/range-sum-query-2d-mutable) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_query_2d_mutable/solution.py) |
  | 341 | [Flatten Nested List Iterator](/problems/flatten-nested-list-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_nested_list_iterator/solution.py) |
  | 346 | [Moving Average from Data Stream](/problems/moving-average-from-data-stream) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/moving_average_from_data_stream/solution.py) |
  | 348 | [Design Tic-Tac-Toe](/problems/design-tic-tac-toe) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_tic_tac_toe/solution.py) |
  | 352 | [Data Stream as Disjoint Intervals](/problems/data-stream-as-disjoint-intervals) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/data_stream_as_disjoint_intervals/solution.py) |
  | 353 | [Design Snake Game](/problems/design-snake-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_snake_game/solution.py) |
  | 355 | [Design Twitter](/problems/design-twitter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_twitter/solution.py) |
  | 359 | [Logger Rate Limiter](/problems/logger-rate-limiter) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/logger_rate_limiter/solution.py) |
  | 362 | [Design Hit Counter](/problems/design-hit-counter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_hit_counter/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) |
  | 380 | [Insert Delete GetRandom O(1)](/problems/insert-delete-getrandom-o1) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insert_delete_getrandom_o1/solution.py) |
  | 381 | [Insert Delete GetRandom O(1) - Duplicates allowed](/problems/insert-delete-getrandom-o1-duplicates-allowed) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insert_delete_getrandom_o1_duplicates_allowed/solution.py) |
  | 384 | [Shuffle an Array](/problems/shuffle-an-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shuffle_an_array/solution.py) |
  | 431 | [Encode N-ary Tree to Binary Tree](/problems/encode-n-ary-tree-to-binary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/encode_n_ary_tree_to_binary_tree/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) |
  | 449 | [Serialize and Deserialize BST](/problems/serialize-and-deserialize-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/serialize_and_deserialize_bst/solution.py) |
  | 460 | [LFU Cache](/problems/lfu-cache) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lfu_cache/solution.py) |
  | 535 | [Encode and Decode TinyURL](/problems/encode-and-decode-tinyurl) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/encode_and_decode_tinyurl/solution.py) |
  | 588 | [Design In-Memory File System](/problems/design-in-memory-file-system) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_in_memory_file_system/solution.py) |
  | 604 | [Design Compressed String Iterator](/problems/design-compressed-string-iterator) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_compressed_string_iterator/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) |
  | 631 | [Design Excel Sum Formula](/problems/design-excel-sum-formula) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_excel_sum_formula/solution.py) |
  | 635 | [Design Log Storage System](/problems/design-log-storage-system) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_log_storage_system/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) |
  | 642 | [Design Search Autocomplete System](/problems/design-search-autocomplete-system) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_search_autocomplete_system/solution.py) |
  | 676 | [Implement Magic Dictionary](/problems/implement-magic-dictionary) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/implement_magic_dictionary/solution.py) |
  | 677 | [Map Sum Pairs](/problems/map-sum-pairs) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/map_sum_pairs/solution.py) |
  | 703 | [Kth Largest Element in a Stream](/problems/kth-largest-element-in-a-stream) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_largest_element_in_a_stream/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) |
  | 715 | [Range Module](/problems/range-module) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_module/solution.py) |
  | 716 | [Max Stack](/problems/max-stack) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_stack/solution.py) |
  | 729 | [My Calendar I](/problems/my-calendar-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/my_calendar_i/solution.py) |
  | 731 | [My Calendar II](/problems/my-calendar-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/my_calendar_ii/solution.py) |
  | 732 | [My Calendar III](/problems/my-calendar-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/my_calendar_iii/solution.py) |
  | 745 | [Prefix and Suffix Search](/problems/prefix-and-suffix-search) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/prefix_and_suffix_search/solution.py) |
  | 855 | [Exam Room](/problems/exam-room) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/exam_room/solution.py) |
  | 895 | [Maximum Frequency Stack](/problems/maximum-frequency-stack) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_frequency_stack/solution.py) |
  | 900 | [RLE Iterator](/problems/rle-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rle_iterator/solution.py) |
  | 901 | [Online Stock Span](/problems/online-stock-span) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/online_stock_span/solution.py) |
  | 911 | [Online Election](/problems/online-election) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/online_election/solution.py) |
  | 919 | [Complete Binary Tree Inserter](/problems/complete-binary-tree-inserter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/complete_binary_tree_inserter/solution.py) |
  | 933 | [Number of Recent Calls](/problems/number-of-recent-calls) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_recent_calls/solution.py) |
  | 981 | [Time Based Key-Value Store](/problems/time-based-key-value-store) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/time_based_key_value_store/solution.py) |
  | 1166 | [Design File System](/problems/design-file-system) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_file_system/solution.py) |
  | 1244 | [Design A Leaderboard](/problems/design-a-leaderboard) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_a_leaderboard/solution.py) |
  | 1279 | [Traffic Light Controlled Intersection](/problems/traffic-light-controlled-intersection) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/traffic_light_controlled_intersection/solution.py) |
  | 1396 | [Design Underground System](/problems/design-underground-system) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_underground_system/solution.py) |
  | 1429 | [First Unique Number](/problems/first-unique-number) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/first_unique_number/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) |
  | 1570 | [Dot Product of Two Sparse Vectors](/problems/dot-product-of-two-sparse-vectors) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/dot_product_of_two_sparse_vectors/solution.py) |
  | 1603 | [Design Parking System](/problems/design-parking-system) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_parking_system/solution.py) |
  | 1845 | [Seat Reservation Manager](/problems/seat-reservation-manager) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/seat_reservation_manager/solution.py) |
  | 1993 | [Operations on Tree](/problems/operations-on-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/operations_on_tree/solution.py) |
  | 2013 | [Detect Squares](/problems/detect-squares) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/detect_squares/solution.py) |
  | 2353 | [Design a Food Rating System](/problems/design-a-food-rating-system) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_a_food_rating_system/solution.py) |
</div>


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