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

# Divide and Conquer in Python with Tests

> All 33 Divide and Conquer LeetCode problems with tested Python solutions.

Divide and Conquer holds 33 problems (4 Easy, 21 Medium, 8 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

<div className="sd-catalog-table">
  | # | Problem | Difficulty | Solution |
  | - | - | - | - |
  | 4 | [Median of Two Sorted Arrays](/problems/median-of-two-sorted-arrays) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/median_of_two_sorted_arrays/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) |
  | 53 | [Maximum Subarray](/problems/maximum-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_subarray/solution.py) |
  | 105 | [Construct Binary Tree from Preorder and Inorder Traversal](/problems/construct-binary-tree-from-preorder-and-inorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_preorder_and_inorder_traversal/solution.py) |
  | 106 | [Construct Binary Tree from Inorder and Postorder Traversal](/problems/construct-binary-tree-from-inorder-and-postorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_inorder_and_postorder_traversal/solution.py) |
  | 108 | [Convert Sorted Array to Binary Search Tree](/problems/convert-sorted-array-to-binary-search-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_sorted_array_to_binary_search_tree/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) |
  | 148 | [Sort List](/problems/sort-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sort_list/solution.py) |
  | 169 | [Majority Element](/problems/majority-element) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/majority_element/solution.py) |
  | 190 | [Reverse Bits](/problems/reverse-bits) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_bits/solution.py) |
  | 191 | [Number of 1 Bits](/problems/number-of-1-bits) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_1_bits/solution.py) |
  | 215 | [Kth Largest Element in an Array](/problems/kth-largest-element-in-an-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_largest_element_in_an_array/solution.py) |
  | 218 | [The Skyline Problem](/problems/the-skyline-problem) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/the_skyline_problem/solution.py) |
  | 240 | [Search a 2D Matrix II](/problems/search-a-2d-matrix-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/search_a_2d_matrix_ii/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) |
  | 315 | [Count of Smaller Numbers After Self](/problems/count-smaller-numbers-after-self) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_smaller_numbers_after_self/solution.py) |
  | 324 | [Wiggle Sort II](/problems/wiggle-sort-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/wiggle_sort_ii/solution.py) |
  | 327 | [Count of Range Sum](/problems/count-of-range-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_of_range_sum/solution.py) |
  | 347 | [Top K Frequent Elements](/problems/top-k-frequent-elements) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/top_k_frequent_elements/solution.py) |
  | 372 | [Super Pow](/problems/super-pow) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/super_pow/solution.py) |
  | 395 | [Longest Substring with At Least K Repeating Characters](/problems/longest-substring-with-at-least-k-repeating-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_substring_with_at_least_k_repeating_characters/solution.py) |
  | 427 | [Construct Quad Tree](/problems/construct-quad-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_quad_tree/solution.py) |
  | 493 | [Reverse Pairs](/problems/reverse-pairs) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_pairs/solution.py) |
  | 558 | [Logical OR of Two Binary Grids Represented as Quad-Trees](/problems/logical-or-of-two-binary-grids-represented-as-quad-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/logical_or_of_two_binary_grids_represented_as_quad_trees/solution.py) |
  | 654 | [Maximum Binary Tree](/problems/maximum-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_binary_tree/solution.py) |
  | 761 | [Special Binary String](/problems/special-binary-string) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/special_binary_string/solution.py) |
  | 889 | [Construct Binary Tree from Preorder and Postorder Traversal](/problems/construct-binary-tree-from-preorder-and-postorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_preorder_and_postorder_traversal/solution.py) |
  | 912 | [Sort an Array](/problems/sort-an-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sort_an_array/solution.py) |
  | 918 | [Maximum Sum Circular Subarray](/problems/maximum-sum-circular-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_sum_circular_subarray/solution.py) |
  | 932 | [Beautiful Array](/problems/beautiful-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/beautiful_array/solution.py) |
  | 973 | [K Closest Points to Origin](/problems/k-closest-points-to-origin) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/k_closest_points_to_origin/solution.py) |
  | 1274 | [Number of Ships in a Rectangle](/problems/number-of-ships-in-a-rectangle) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_ships_in_a_rectangle/solution.py) |
  | 1985 | [Find the Kth Largest Integer in the Array](/problems/kth-largest-number-in-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_largest_number_in_array/solution.py) |
</div>


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