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

# Prefix Sum in Python with Tests

> All 63 Prefix Sum LeetCode problems with tested Python solutions.

Prefix Sum holds 63 problems (3 Easy, 47 Medium, 13 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 209 | [Minimum Size Subarray Sum](https://leetcode-py.wisl.dev/problems/minimum-size-subarray-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_size_subarray_sum/solution.py) |
| 238 | [Product of Array Except Self](https://leetcode-py.wisl.dev/problems/product-of-array-except-self) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/product_of_array_except_self/solution.py) |
| 303 | [Range Sum Query - Immutable](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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) |
| 325 | [Maximum Size Subarray Sum Equals k](https://leetcode-py.wisl.dev/problems/maximum-size-subarray-sum-equals-k) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_size_subarray_sum_equals_k/solution.py) |
| 363 | [Max Sum of Rectangle No Larger Than K](https://leetcode-py.wisl.dev/problems/max-sum-of-rectangle-no-larger-than-k) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_sum_of_rectangle_no_larger_than_k/solution.py) |
| 370 | [Range Addition](https://leetcode-py.wisl.dev/problems/range-addition) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_addition/solution.py) |
| 410 | [Split Array Largest Sum](https://leetcode-py.wisl.dev/problems/split-array-largest-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_array_largest_sum/solution.py) |
| 497 | [Random Point in Non-overlapping Rectangles](https://leetcode-py.wisl.dev/problems/random-point-in-non-overlapping-rectangles) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/random_point_in_non_overlapping_rectangles/solution.py) |
| 523 | [Continuous Subarray Sum](https://leetcode-py.wisl.dev/problems/continuous-subarray-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/continuous_subarray_sum/solution.py) |
| 525 | [Contiguous Array](https://leetcode-py.wisl.dev/problems/contiguous-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/contiguous_array/solution.py) |
| 528 | [Random Pick with Weight](https://leetcode-py.wisl.dev/problems/random-pick-with-weight) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/random_pick_with_weight/solution.py) |
| 548 | [Split Array with Equal Sum](https://leetcode-py.wisl.dev/problems/split-array-with-equal-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_array_with_equal_sum/solution.py) |
| 560 | [Subarray Sum Equals K](https://leetcode-py.wisl.dev/problems/subarray-sum-equals-k) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subarray_sum_equals_k/solution.py) |
| 644 | [Maximum Average Subarray II](https://leetcode-py.wisl.dev/problems/maximum-average-subarray-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_average_subarray_ii/solution.py) |
| 724 | [Find Pivot Index](https://leetcode-py.wisl.dev/problems/find-pivot-index) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_pivot_index/solution.py) |
| 731 | [My Calendar II](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/my-calendar-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/my_calendar_iii/solution.py) |
| 798 | [Smallest Rotation with Highest Score](https://leetcode-py.wisl.dev/problems/smallest-rotation-with-highest-score) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/smallest_rotation_with_highest_score/solution.py) |
| 813 | [Largest Sum of Averages](https://leetcode-py.wisl.dev/problems/largest-sum-of-averages) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_sum_of_averages/solution.py) |
| 848 | [Shifting Letters](https://leetcode-py.wisl.dev/problems/shifting-letters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shifting_letters/solution.py) |
| 862 | [Shortest Subarray with Sum at Least K](https://leetcode-py.wisl.dev/problems/shortest-subarray-with-sum-at-least-k) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_subarray_with_sum_at_least_k/solution.py) |
| 903 | [Valid Permutations for DI Sequence](https://leetcode-py.wisl.dev/problems/valid-permutations-for-di-sequence) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/valid_permutations_for_di_sequence/solution.py) |
| 930 | [Binary Subarrays With Sum](https://leetcode-py.wisl.dev/problems/binary-subarrays-with-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_subarrays_with_sum/solution.py) |
| 974 | [Subarray Sums Divisible by K](https://leetcode-py.wisl.dev/problems/subarray-sums-divisible-by-k) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subarray_sums_divisible_by_k/solution.py) |
| 995 | [Minimum Number of K Consecutive Bit Flips](https://leetcode-py.wisl.dev/problems/minimum-number-of-k-consecutive-bit-flips) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_k_consecutive_bit_flips/solution.py) |
| 1000 | [Minimum Cost to Merge Stones](https://leetcode-py.wisl.dev/problems/minimum-cost-to-merge-stones) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_cost_to_merge_stones/solution.py) |
| 1004 | [Max Consecutive Ones III](https://leetcode-py.wisl.dev/problems/max-consecutive-ones-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_consecutive_ones_iii/solution.py) |
| 1074 | [Number of Submatrices That Sum to Target](https://leetcode-py.wisl.dev/problems/number-of-submatrices-that-sum-to-target) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_submatrices_that_sum_to_target/solution.py) |
| 1094 | [Car Pooling](https://leetcode-py.wisl.dev/problems/car-pooling) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/car_pooling/solution.py) |
| 1140 | [Stone Game II](https://leetcode-py.wisl.dev/problems/stone-game-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/stone_game_ii/solution.py) |
| 1208 | [Get Equal Substrings Within Budget](https://leetcode-py.wisl.dev/problems/get-equal-substrings-within-budget) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/get_equal_substrings_within_budget/solution.py) |
| 1248 | [Count Number of Nice Subarrays](https://leetcode-py.wisl.dev/problems/count-number-of-nice-subarrays) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_number_of_nice_subarrays/solution.py) |
| 1310 | [XOR Queries of a Subarray](https://leetcode-py.wisl.dev/problems/xor-queries-of-a-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/xor_queries_of_a_subarray/solution.py) |
| 1371 | [Find the Longest Substring Containing Vowels in Even Counts](https://leetcode-py.wisl.dev/problems/find-the-longest-substring-containing-vowels-in-even-counts) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_longest_substring_containing_vowels_in_even_counts/solution.py) |
| 1422 | [Maximum Score After Splitting a String](https://leetcode-py.wisl.dev/problems/maximum-score-after-splitting-a-string) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_score_after_splitting_a_string/solution.py) |
| 1423 | [Maximum Points You Can Obtain from Cards](https://leetcode-py.wisl.dev/problems/maximum-points-you-can-obtain-from-cards) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_points_you_can_obtain_from_cards/solution.py) |
| 1442 | [Count Triplets That Can Form Two Arrays of Equal XOR](https://leetcode-py.wisl.dev/problems/count-triplets-that-can-form-two-arrays-of-equal-xor) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_triplets_that_can_form_two_arrays_of_equal_xor/solution.py) |
| 1508 | [Range Sum of Sorted Subarray Sums](https://leetcode-py.wisl.dev/problems/range-sum-of-sorted-subarray-sums) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_of_sorted_subarray_sums/solution.py) |
| 1524 | [Number of Sub-arrays With Odd Sum](https://leetcode-py.wisl.dev/problems/number-of-subarrays-with-odd-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_subarrays_with_odd_sum/solution.py) |
| 1590 | [Make Sum Divisible by P](https://leetcode-py.wisl.dev/problems/make-sum-divisible-by-p) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/make_sum_divisible_by_p/solution.py) |
| 1658 | [Minimum Operations to Reduce X to Zero](https://leetcode-py.wisl.dev/problems/minimum-operations-to-reduce-x-to-zero) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_operations_to_reduce_x_to_zero/solution.py) |
| 1685 | [Sum of Absolute Differences in a Sorted Array](https://leetcode-py.wisl.dev/problems/sum-of-absolute-differences-in-a-sorted-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_absolute_differences_in_a_sorted_array/solution.py) |
| 1769 | [Minimum Number of Operations to Move All Balls to Each Box](https://leetcode-py.wisl.dev/problems/minimum-number-of-operations-to-move-all-balls-to-each-box) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_operations_to_move_all_balls_to_each_box/solution.py) |
| 1829 | [Maximum XOR for Each Query](https://leetcode-py.wisl.dev/problems/maximum-xor-for-each-query) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_xor_for_each_query/solution.py) |
| 1838 | [Frequency of the Most Frequent Element](https://leetcode-py.wisl.dev/problems/frequency-of-the-most-frequent-element) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/frequency_of_the_most_frequent_element/solution.py) |
| 1856 | [Maximum Subarray Min-Product](https://leetcode-py.wisl.dev/problems/maximum-subarray-min-product) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_subarray_min_product/solution.py) |
| 1871 | [Jump Game VII](https://leetcode-py.wisl.dev/problems/jump-game-vii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/jump_game_vii/solution.py) |
| 1930 | [Unique Length-3 Palindromic Subsequences](https://leetcode-py.wisl.dev/problems/unique-length-3-palindromic-subsequences) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_length_3_palindromic_subsequences/solution.py) |
| 2017 | [Grid Game](https://leetcode-py.wisl.dev/problems/grid-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/grid_game/solution.py) |
| 2021 | [Brightest Position on Street](https://leetcode-py.wisl.dev/problems/brightest-position-on-street) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/brightest_position_on_street/solution.py) |
| 2145 | [Count the Hidden Sequences](https://leetcode-py.wisl.dev/problems/count-the-hidden-sequences) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_the_hidden_sequences/solution.py) |
| 2218 | [Maximum Value of K Coins From Piles](https://leetcode-py.wisl.dev/problems/maximum-value-of-k-coins-from-piles) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_value_of_k_coins_from_piles/solution.py) |
| 2251 | [Number of Flowers in Full Bloom](https://leetcode-py.wisl.dev/problems/number-of-flowers-in-full-bloom) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_flowers_in_full_bloom/solution.py) |
| 2270 | [Number of Ways to Split Array](https://leetcode-py.wisl.dev/problems/number-of-ways-to-split-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_ways_to_split_array/solution.py) |
| 2381 | [Shifting Letters II](https://leetcode-py.wisl.dev/problems/shifting-letters-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shifting_letters_ii/solution.py) |
| 2406 | [Divide Intervals Into Minimum Number of Groups](https://leetcode-py.wisl.dev/problems/divide-intervals-into-minimum-number-of-groups) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/divide_intervals_into_minimum_number_of_groups/solution.py) |
| 2439 | [Minimize Maximum of Array](https://leetcode-py.wisl.dev/problems/minimize-maximum-of-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimize_maximum_of_array/solution.py) |
| 2483 | [Minimum Penalty for a Shop](https://leetcode-py.wisl.dev/problems/minimum-penalty-for-a-shop) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_penalty_for_a_shop/solution.py) |
| 2559 | [Count Vowel Strings in Ranges](https://leetcode-py.wisl.dev/problems/count-vowel-strings-in-ranges) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_vowel_strings_in_ranges/solution.py) |
| 2971 | [Find Polygon With the Largest Perimeter](https://leetcode-py.wisl.dev/problems/find-polygon-with-the-largest-perimeter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_polygon_with_the_largest_perimeter/solution.py) |
| 3191 | [Minimum Operations to Make Binary Array Elements Equal to One I](https://leetcode-py.wisl.dev/problems/minimum-operations-to-make-binary-array-elements-equal-to-one-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_operations_to_make_binary_array_elements_equal_to_one_i/solution.py) |
| 3434 | [Maximum Frequency After Subarray Operation](https://leetcode-py.wisl.dev/problems/maximum-frequency-after-subarray-operation) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_frequency_after_subarray_operation/solution.py) |


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