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

# Counting in Python with Tests

> All 49 Counting LeetCode problems with tested Python solutions.

Counting holds 49 problems (18 Easy, 26 Medium, 5 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 169 | [Majority Element](https://leetcode-py.wisl.dev/problems/majority-element) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/majority_element/solution.py) |
| 229 | [Majority Element II](https://leetcode-py.wisl.dev/problems/majority-element-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/majority_element_ii/solution.py) |
| 299 | [Bulls and Cows](https://leetcode-py.wisl.dev/problems/bulls-and-cows) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/bulls_and_cows/solution.py) |
| 347 | [Top K Frequent Elements](https://leetcode-py.wisl.dev/problems/top-k-frequent-elements) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/top_k_frequent_elements/solution.py) |
| 358 | [Rearrange String k Distance Apart](https://leetcode-py.wisl.dev/problems/rearrange-string-k-distance-apart) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rearrange_string_k_distance_apart/solution.py) |
| 383 | [Ransom Note](https://leetcode-py.wisl.dev/problems/ransom-note) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/ransom_note/solution.py) |
| 387 | [First Unique Character in a String](https://leetcode-py.wisl.dev/problems/first-unique-character-in-a-string) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/first_unique_character_in_a_string/solution.py) |
| 451 | [Sort Characters By Frequency](https://leetcode-py.wisl.dev/problems/sort-characters-by-frequency) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sort_characters_by_frequency/solution.py) |
| 594 | [Longest Harmonious Subsequence](https://leetcode-py.wisl.dev/problems/longest-harmonious-subsequence) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_harmonious_subsequence/solution.py) |
| 621 | [Task Scheduler](https://leetcode-py.wisl.dev/problems/task-scheduler) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/task_scheduler/solution.py) |
| 692 | [Top K Frequent Words](https://leetcode-py.wisl.dev/problems/top-k-frequent-words) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/top_k_frequent_words/solution.py) |
| 767 | [Reorganize String](https://leetcode-py.wisl.dev/problems/reorganize-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reorganize_string/solution.py) |
| 811 | [Subdomain Visit Count](https://leetcode-py.wisl.dev/problems/subdomain-visit-count) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subdomain_visit_count/solution.py) |
| 819 | [Most Common Word](https://leetcode-py.wisl.dev/problems/most-common-word) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/most_common_word/solution.py) |
| 869 | [Reordered Power of 2](https://leetcode-py.wisl.dev/problems/reordered-power-of-2) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reordered_power_of_2/solution.py) |
| 884 | [Uncommon Words from Two Sentences](https://leetcode-py.wisl.dev/problems/uncommon-words-from-two-sentences) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/uncommon_words_from_two_sentences/solution.py) |
| 900 | [RLE Iterator](https://leetcode-py.wisl.dev/problems/rle-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rle_iterator/solution.py) |
| 914 | [X of a Kind in a Deck of Cards](https://leetcode-py.wisl.dev/problems/x-of-a-kind-in-a-deck-of-cards) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/x_of_a_kind_in_a_deck_of_cards/solution.py) |
| 923 | [3Sum With Multiplicity](https://leetcode-py.wisl.dev/problems/three-sum-multiplicity) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/three_sum_multiplicity/solution.py) |
| 945 | [Minimum Increment to Make Array Unique](https://leetcode-py.wisl.dev/problems/minimum-increment-to-make-array-unique) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_increment_to_make_array_unique/solution.py) |
| 992 | [Subarrays with K Different Integers](https://leetcode-py.wisl.dev/problems/subarrays-with-k-different-integers) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subarrays_with_k_different_integers/solution.py) |
| 1079 | [Letter Tile Possibilities](https://leetcode-py.wisl.dev/problems/letter-tile-possibilities) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/letter_tile_possibilities/solution.py) |
| 1160 | [Find Words That Can Be Formed by Characters](https://leetcode-py.wisl.dev/problems/find-words-that-can-be-formed-by-characters) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_words_that_can_be_formed_by_characters/solution.py) |
| 1189 | [Maximum Number of Balloons](https://leetcode-py.wisl.dev/problems/maximum-number-of-balloons) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_number_of_balloons/solution.py) |
| 1198 | [Find Smallest Common Element in All Rows](https://leetcode-py.wisl.dev/problems/find-smallest-common-element-in-all-rows) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_smallest_common_element_in_all_rows/solution.py) |
| 1255 | [Maximum Score Words Formed by Letters](https://leetcode-py.wisl.dev/problems/maximum-score-words-formed-by-letters) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_score_words_formed_by_letters/solution.py) |
| 1267 | [Count Servers that Communicate](https://leetcode-py.wisl.dev/problems/count-servers-that-communicate) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_servers_that_communicate/solution.py) |
| 1394 | [Find Lucky Integer in an Array](https://leetcode-py.wisl.dev/problems/find-lucky-integer-in-an-array) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_lucky_integer_in_an_array/solution.py) |
| 1400 | [Construct K Palindrome Strings](https://leetcode-py.wisl.dev/problems/construct-k-palindrome-strings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_k_palindrome_strings/solution.py) |
| 1481 | [Least Number of Unique Integers after K Removals](https://leetcode-py.wisl.dev/problems/least-number-of-unique-integers-after-k-removals) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/least_number_of_unique_integers_after_k_removals/solution.py) |
| 1512 | [Number of Good Pairs](https://leetcode-py.wisl.dev/problems/number-of-good-pairs) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_good_pairs/solution.py) |
| 1603 | [Design Parking System](https://leetcode-py.wisl.dev/problems/design-parking-system) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/design_parking_system/solution.py) |
| 1684 | [Count the Number of Consistent Strings](https://leetcode-py.wisl.dev/problems/count-the-number-of-consistent-strings) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_the_number_of_consistent_strings/solution.py) |
| 1726 | [Tuple with Same Product](https://leetcode-py.wisl.dev/problems/tuple-with-same-product) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/tuple_with_same_product/solution.py) |
| 1790 | [Check if One String Swap Can Make Strings Equal](https://leetcode-py.wisl.dev/problems/check-if-one-string-swap-can-make-strings-equal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/check_if_one_string_swap_can_make_strings_equal/solution.py) |
| 1857 | [Largest Color Value in a Directed Graph](https://leetcode-py.wisl.dev/problems/largest-color-value-in-a-directed-graph) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_color_value_in_a_directed_graph/solution.py) |
| 1897 | [Redistribute Characters to Make All Strings Equal](https://leetcode-py.wisl.dev/problems/redistribute-characters-to-make-all-strings-equal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/redistribute_characters_to_make_all_strings_equal/solution.py) |
| 2001 | [Number of Pairs of Interchangeable Rectangles](https://leetcode-py.wisl.dev/problems/number-of-pairs-of-interchangeable-rectangles) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_pairs_of_interchangeable_rectangles/solution.py) |
| 2013 | [Detect Squares](https://leetcode-py.wisl.dev/problems/detect-squares) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/detect_squares/solution.py) |
| 2053 | [Kth Distinct String in an Array](https://leetcode-py.wisl.dev/problems/kth-distinct-string-in-an-array) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_distinct_string_in_an_array/solution.py) |
| 2182 | [Construct String With Repeat Limit](https://leetcode-py.wisl.dev/problems/construct-string-with-repeat-limit) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_string_with_repeat_limit/solution.py) |
| 2206 | [Divide Array Into Equal Pairs](https://leetcode-py.wisl.dev/problems/divide-array-into-equal-pairs) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/divide_array_into_equal_pairs/solution.py) |
| 2275 | [Largest Combination With Bitwise AND Greater Than Zero](https://leetcode-py.wisl.dev/problems/largest-combination-with-bitwise-and-greater-than-zero) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_combination_with_bitwise_and_greater_than_zero/solution.py) |
| 2364 | [Count Number of Bad Pairs](https://leetcode-py.wisl.dev/problems/count-number-of-bad-pairs) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_number_of_bad_pairs/solution.py) |
| 2416 | [Sum of Prefix Scores of Strings](https://leetcode-py.wisl.dev/problems/sum-of-prefix-scores-of-strings) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_prefix_scores_of_strings/solution.py) |
| 2870 | [Minimum Number of Operations to Make Array Empty](https://leetcode-py.wisl.dev/problems/minimum-number-of-operations-to-make-array-empty) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_operations_to_make_array_empty/solution.py) |
| 3016 | [Minimum Number of Pushes to Type Word II](https://leetcode-py.wisl.dev/problems/minimum-number-of-pushes-to-type-word-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_pushes_to_type_word_ii/solution.py) |
| 3223 | [Minimum Length of String After Operations](https://leetcode-py.wisl.dev/problems/minimum-length-of-string-after-operations) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_length_of_string_after_operations/solution.py) |
| 3442 | [Maximum Difference Between Even and Odd Frequency I](https://leetcode-py.wisl.dev/problems/maximum-difference-between-even-and-odd-frequency-i) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_difference_between_even_and_odd_frequency_i/solution.py) |


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