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

# Dynamic Programming in Python with Tests

> All 242 Dynamic Programming LeetCode problems with tested Python solutions. Part 1 of 2: problems 1-200.

Dynamic Programming holds 242 problems (9 Easy, 139 Medium, 94 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

<div className="sd-catalog-table">
  | # | Problem | Difficulty | Solution |
  | - | - | - | - |
  | 5 | [Longest Palindromic Substring](/problems/longest-palindromic-substring) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_palindromic_substring/solution.py) |
  | 10 | [Regular Expression Matching](/problems/regular-expression-matching) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/regular_expression_matching/solution.py) |
  | 22 | [Generate Parentheses](/problems/generate-parentheses) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/generate_parentheses/solution.py) |
  | 32 | [Longest Valid Parentheses](/problems/longest-valid-parentheses) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_valid_parentheses/solution.py) |
  | 42 | [Trapping Rain Water](/problems/trapping-rain-water) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/trapping_rain_water/solution.py) |
  | 44 | [Wildcard Matching](/problems/wildcard-matching) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/wildcard_matching/solution.py) |
  | 45 | [Jump Game II](/problems/jump-game-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/jump_game_ii/solution.py) |
  | 53 | [Maximum Subarray](/problems/maximum-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_subarray/solution.py) |
  | 55 | [Jump Game](/problems/jump-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/jump_game/solution.py) |
  | 62 | [Unique Paths](/problems/unique-paths) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_paths/solution.py) |
  | 63 | [Unique Paths II](/problems/unique-paths-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_paths_ii/solution.py) |
  | 64 | [Minimum Path Sum](/problems/minimum-path-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_path_sum/solution.py) |
  | 70 | [Climbing Stairs](/problems/climbing-stairs) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/climbing_stairs/solution.py) |
  | 72 | [Edit Distance](/problems/edit-distance) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/edit_distance/solution.py) |
  | 85 | [Maximal Rectangle](/problems/maximal-rectangle) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximal_rectangle/solution.py) |
  | 87 | [Scramble String](/problems/scramble-string) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/scramble_string/solution.py) |
  | 91 | [Decode Ways](/problems/decode-ways) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/decode_ways/solution.py) |
  | 95 | [Unique Binary Search Trees II](/problems/unique-binary-search-trees-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_binary_search_trees_ii/solution.py) |
  | 96 | [Unique Binary Search Trees](/problems/unique-binary-search-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_binary_search_trees/solution.py) |
  | 97 | [Interleaving String](/problems/interleaving-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/interleaving_string/solution.py) |
  | 115 | [Distinct Subsequences](/problems/distinct-subsequences) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/distinct_subsequences/solution.py) |
  | 118 | [Pascal's Triangle](/problems/pascals-triangle) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/pascals_triangle/solution.py) |
  | 119 | [Pascal's Triangle II](/problems/pascals-triangle-ii) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/pascals_triangle_ii/solution.py) |
  | 120 | [Triangle](/problems/triangle) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/triangle/solution.py) |
  | 121 | [Best Time to Buy and Sell Stock](/problems/best-time-to-buy-and-sell-stock) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock/solution.py) |
  | 122 | [Best Time to Buy and Sell Stock II](/problems/best-time-to-buy-and-sell-stock-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock_ii/solution.py) |
  | 123 | [Best Time to Buy and Sell Stock III](/problems/best-time-to-buy-and-sell-stock-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock_iii/solution.py) |
  | 124 | [Binary Tree Maximum Path Sum](/problems/binary-tree-maximum-path-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_maximum_path_sum/solution.py) |
  | 131 | [Palindrome Partitioning](/problems/palindrome-partitioning) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/palindrome_partitioning/solution.py) |
  | 132 | [Palindrome Partitioning II](/problems/palindrome-partitioning-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/palindrome_partitioning_ii/solution.py) |
  | 139 | [Word Break](/problems/word-break) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/word_break/solution.py) |
  | 140 | [Word Break II](/problems/word-break-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/word_break_ii/solution.py) |
  | 152 | [Maximum Product Subarray](/problems/maximum-product-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_product_subarray/solution.py) |
  | 174 | [Dungeon Game](/problems/dungeon-game) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/dungeon_game/solution.py) |
  | 188 | [Best Time to Buy and Sell Stock IV](/problems/best-time-to-buy-and-sell-stock-iv) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock_iv/solution.py) |
  | 198 | [House Robber](/problems/house-robber) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/house_robber/solution.py) |
  | 213 | [House Robber II](/problems/house-robber-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/house_robber_ii/solution.py) |
  | 221 | [Maximal Square](/problems/maximal-square) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximal_square/solution.py) |
  | 233 | [Number of Digit One](/problems/number-of-digit-one) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_digit_one/solution.py) |
  | 241 | [Different Ways to Add Parentheses](/problems/different-ways-to-add-parentheses) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/different_ways_to_add_parentheses/solution.py) |
  | 256 | [Paint House](/problems/paint-house) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/paint_house/solution.py) |
  | 264 | [Ugly Number II](/problems/ugly-number-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/ugly_number_ii/solution.py) |
  | 265 | [Paint House II](/problems/paint-house-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/paint_house_ii/solution.py) |
  | 276 | [Paint Fence](/problems/paint-fence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/paint_fence/solution.py) |
  | 279 | [Perfect Squares](/problems/perfect-squares) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/perfect_squares/solution.py) |
  | 294 | [Flip Game II](/problems/flip-game-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flip_game_ii/solution.py) |
  | 300 | [Longest Increasing Subsequence](/problems/longest-increasing-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_increasing_subsequence/solution.py) |
  | 309 | [Best Time to Buy and Sell Stock with Cooldown](/problems/best-time-to-buy-and-sell-stock-with-cooldown) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock_with_cooldown/solution.py) |
  | 312 | [Burst Balloons](/problems/burst-balloons) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/burst_balloons/solution.py) |
  | 313 | [Super Ugly Number](/problems/super-ugly-number) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/super_ugly_number/solution.py) |
  | 322 | [Coin Change](/problems/coin-change) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/coin_change/solution.py) |
  | 329 | [Longest Increasing Path in a Matrix](/problems/longest-increasing-path-in-a-matrix) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_increasing_path_in_a_matrix/solution.py) |
  | 333 | [Largest BST Subtree](/problems/largest-bst-subtree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_bst_subtree/solution.py) |
  | 337 | [House Robber III](/problems/house-robber-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/house_robber_iii/solution.py) |
  | 338 | [Counting Bits](/problems/counting-bits) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/counting_bits/solution.py) |
  | 343 | [Integer Break](/problems/integer-break) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/integer_break/solution.py) |
  | 351 | [Android Unlock Patterns](/problems/android-unlock-patterns) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/android_unlock_patterns/solution.py) |
  | 354 | [Russian Doll Envelopes](/problems/russian-doll-envelopes) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/russian_doll_envelopes/solution.py) |
  | 357 | [Count Numbers with Unique Digits](/problems/count-numbers-with-unique-digits) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_numbers_with_unique_digits/solution.py) |
  | 361 | [Bomb Enemy](/problems/bomb-enemy) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/bomb_enemy/solution.py) |
  | 368 | [Largest Divisible Subset](/problems/largest-divisible-subset) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_divisible_subset/solution.py) |
  | 375 | [Guess Number Higher or Lower II](/problems/guess-number-higher-or-lower-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/guess_number_higher_or_lower_ii/solution.py) |
  | 376 | [Wiggle Subsequence](/problems/wiggle-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/wiggle_subsequence/solution.py) |
  | 377 | [Combination Sum IV](/problems/combination-sum-iv) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/combination_sum_iv/solution.py) |
  | 392 | [Is Subsequence](/problems/is-subsequence) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/is_subsequence/solution.py) |
  | 396 | [Rotate Function](/problems/rotate-function) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rotate_function/solution.py) |
  | 397 | [Integer Replacement](/problems/integer-replacement) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/integer_replacement/solution.py) |
  | 403 | [Frog Jump](/problems/frog-jump) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/frog_jump/solution.py) |
  | 410 | [Split Array Largest Sum](/problems/split-array-largest-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_array_largest_sum/solution.py) |
  | 413 | [Arithmetic Slices](/problems/arithmetic-slices) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/arithmetic_slices/solution.py) |
  | 416 | [Partition Equal Subset Sum](/problems/partition-equal-subset-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/partition_equal_subset_sum/solution.py) |
  | 418 | [Sentence Screen Fitting](/problems/sentence-screen-fitting) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sentence_screen_fitting/solution.py) |
  | 435 | [Non-overlapping Intervals](/problems/non-overlapping-intervals) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/non_overlapping_intervals/solution.py) |
  | 446 | [Arithmetic Slices II - Subsequence](/problems/arithmetic-slices-ii-subsequence) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/arithmetic_slices_ii_subsequence/solution.py) |
  | 458 | [Poor Pigs](/problems/poor-pigs) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/poor_pigs/solution.py) |
  | 464 | [Can I Win](/problems/can-i-win) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/can_i_win/solution.py) |
  | 465 | [Optimal Account Balancing](/problems/optimal-account-balancing) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/optimal_account_balancing/solution.py) |
  | 466 | [Count The Repetitions](/problems/count-the-repetitions) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_the_repetitions/solution.py) |
  | 467 | [Unique Substrings in Wraparound String](/problems/unique-substrings-in-wraparound-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_substrings_in_wraparound_string/solution.py) |
  | 471 | [Encode String with Shortest Length](/problems/encode-string-with-shortest-length) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/encode_string_with_shortest_length/solution.py) |
  | 472 | [Concatenated Words](/problems/concatenated-words) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/concatenated_words/solution.py) |
  | 473 | [Matchsticks to Square](/problems/matchsticks-to-square) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/matchsticks_to_square/solution.py) |
  | 474 | [Ones and Zeroes](/problems/ones-and-zeroes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/ones_and_zeroes/solution.py) |
  | 486 | [Predict the Winner](/problems/predict-the-winner) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/predict_the_winner/solution.py) |
  | 487 | [Max Consecutive Ones II](/problems/max-consecutive-ones-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_consecutive_ones_ii/solution.py) |
  | 488 | [Zuma Game](/problems/zuma-game) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/zuma_game/solution.py) |
  | 494 | [Target Sum](/problems/target-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/target_sum/solution.py) |
  | 509 | [Fibonacci Number](/problems/fibonacci-number) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/fibonacci_number/solution.py) |
  | 514 | [Freedom Trail](/problems/freedom-trail) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/freedom_trail/solution.py) |
  | 516 | [Longest Palindromic Subsequence](/problems/longest-palindromic-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_palindromic_subsequence/solution.py) |
  | 518 | [Coin Change II](/problems/coin-change-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/coin_change_ii/solution.py) |
  | 526 | [Beautiful Arrangement](/problems/beautiful-arrangement) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/beautiful_arrangement/solution.py) |
  | 542 | [01 Matrix](/problems/zero-one-matrix) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/zero_one_matrix/solution.py) |
  | 546 | [Remove Boxes](/problems/remove-boxes) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_boxes/solution.py) |
  | 552 | [Student Attendance Record II](/problems/student-attendance-record-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/student_attendance_record_ii/solution.py) |
  | 553 | [Optimal Division](/problems/optimal-division) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/optimal_division/solution.py) |
  | 562 | [Longest Line of Consecutive One in Matrix](/problems/longest-line-of-consecutive-one-in-matrix) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_line_of_consecutive_one_in_matrix/solution.py) |
  | 568 | [Maximum Vacation Days](/problems/maximum-vacation-days) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_vacation_days/solution.py) |
  | 576 | [Out of Boundary Paths](/problems/out-of-boundary-paths) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/out_of_boundary_paths/solution.py) |
  | 583 | [Delete Operation for Two Strings](/problems/delete-operation-for-two-strings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_operation_for_two_strings/solution.py) |
  | 600 | [Non-negative Integers without Consecutive Ones](/problems/non-negative-integers-without-consecutive-ones) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/non_negative_integers_without_consecutive_ones/solution.py) |
  | 629 | [K Inverse Pairs Array](/problems/k-inverse-pairs-array) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/k_inverse_pairs_array/solution.py) |
  | 634 | [Find the Derangement of An Array](/problems/find-the-derangement-of-an-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_derangement_of_an_array/solution.py) |
  | 638 | [Shopping Offers](/problems/shopping-offers) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shopping_offers/solution.py) |
  | 639 | [Decode Ways II](/problems/decode-ways-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/decode_ways_ii/solution.py) |
  | 646 | [Maximum Length of Pair Chain](/problems/maximum-length-of-pair-chain) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_length_of_pair_chain/solution.py) |
  | 647 | [Palindromic Substrings](/problems/palindromic-substrings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/palindromic_substrings/solution.py) |
  | 650 | [2 Keys Keyboard](/problems/two-keys-keyboard) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/two_keys_keyboard/solution.py) |
  | 651 | [4 Keys Keyboard](/problems/four-keys-keyboard) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/four_keys_keyboard/solution.py) |
  | 656 | [Coin Path](/problems/coin-path) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/coin_path/solution.py) |
  | 664 | [Strange Printer](/problems/strange-printer) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/strange_printer/solution.py) |
  | 673 | [Number of Longest Increasing Subsequence](/problems/number-of-longest-increasing-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_longest_increasing_subsequence/solution.py) |
  | 678 | [Valid Parenthesis String](/problems/valid-parenthesis-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/valid_parenthesis_string/solution.py) |
  | 687 | [Longest Univalue Path](/problems/longest-univalue-path) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_univalue_path/solution.py) |
  | 688 | [Knight Probability in Chessboard](/problems/knight-probability-in-chessboard) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/knight_probability_in_chessboard/solution.py) |
  | 689 | [Maximum Sum of 3 Non-Overlapping Subarrays](/problems/maximum-sum-of-3-non-overlapping-subarrays) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_sum_of_3_non_overlapping_subarrays/solution.py) |
  | 691 | [Stickers to Spell Word](/problems/stickers-to-spell-word) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/stickers_to_spell_word/solution.py) |
  | 698 | [Partition to K Equal Sum Subsets](/problems/partition-to-k-equal-sum-subsets) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/partition_to_k_equal_sum_subsets/solution.py) |
  | 712 | [Minimum ASCII Delete Sum for Two Strings](/problems/minimum-ascii-delete-sum-for-two-strings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_ascii_delete_sum_for_two_strings/solution.py) |
  | 714 | [Best Time to Buy and Sell Stock with Transaction Fee](/problems/best-time-to-buy-and-sell-stock-with-transaction-fee) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_time_to_buy_and_sell_stock_with_transaction_fee/solution.py) |
  | 718 | [Maximum Length of Repeated Subarray](/problems/maximum-length-of-repeated-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_length_of_repeated_subarray/solution.py) |
  | 727 | [Minimum Window Subsequence](/problems/minimum-window-subsequence) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_window_subsequence/solution.py) |
  | 730 | [Count Different Palindromic Subsequences](/problems/count-palindromic-subsequences) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_palindromic_subsequences/solution.py) |
  | 740 | [Delete and Earn](/problems/delete-and-earn) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_and_earn/solution.py) |
  | 741 | [Cherry Pickup](/problems/cherry-pickup) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cherry_pickup/solution.py) |
  | 746 | [Min Cost Climbing Stairs](/problems/min-cost-climbing-stairs) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/min_cost_climbing_stairs/solution.py) |
  | 750 | [Number Of Corner Rectangles](/problems/number-of-corner-rectangles) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_corner_rectangles/solution.py) |
  | 764 | [Largest Plus Sign](/problems/largest-plus-sign) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_plus_sign/solution.py) |
  | 787 | [Cheapest Flights Within K Stops](/problems/cheapest-flights-within-k-stops) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cheapest_flights_within_k_stops/solution.py) |
  | 788 | [Rotated Digits](/problems/rotated-digits) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/rotated_digits/solution.py) |
  | 790 | [Domino and Tromino Tiling](/problems/domino-and-tromino-tiling) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/domino_and_tromino_tiling/solution.py) |
  | 792 | [Number of Matching Subsequences](/problems/number-of-matching-subsequences) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_matching_subsequences/solution.py) |
  | 799 | [Champagne Tower](/problems/champagne-tower) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/champagne_tower/solution.py) |
  | 801 | [Minimum Swaps To Make Sequences Increasing](/problems/minimum-swaps-to-make-sequences-increasing) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_swaps_to_make_sequences_increasing/solution.py) |
  | 805 | [Split Array With Same Average](/problems/split-array-with-same-average) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_array_with_same_average/solution.py) |
  | 808 | [Soup Servings](/problems/soup-servings) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/soup_servings/solution.py) |
  | 813 | [Largest Sum of Averages](/problems/largest-sum-of-averages) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_sum_of_averages/solution.py) |
  | 818 | [Race Car](/problems/race-car) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/race_car/solution.py) |
  | 823 | [Binary Trees With Factors](/problems/binary-trees-with-factors) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_trees_with_factors/solution.py) |
  | 828 | [Count Unique Characters of All Substrings of a Given String](/problems/count-unique-characters-of-all-substrings-of-a-given-string) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_unique_characters_of_all_substrings_of_a_given_string/solution.py) |
  | 834 | [Sum of Distances in Tree](/problems/sum-of-distances-in-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_distances_in_tree/solution.py) |
  | 837 | [New 21 Game](/problems/new-21-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/new_21_game/solution.py) |
  | 838 | [Push Dominoes](/problems/push-dominoes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/push_dominoes/solution.py) |
  | 845 | [Longest Mountain in Array](/problems/longest-mountain-in-array) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_mountain_in_array/solution.py) |
  | 847 | [Shortest Path Visiting All Nodes](/problems/shortest-path-visiting-all-nodes) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_path_visiting_all_nodes/solution.py) |
  | 871 | [Minimum Number of Refueling Stops](/problems/minimum-number-of-refueling-stops) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_refueling_stops/solution.py) |
  | 873 | [Length of Longest Fibonacci Subsequence](/problems/length-of-longest-fibonacci-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/length_of_longest_fibonacci_subsequence/solution.py) |
  | 877 | [Stone Game](/problems/stone-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/stone_game/solution.py) |
  | 879 | [Profitable Schemes](/problems/profitable-schemes) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/profitable_schemes/solution.py) |
  | 887 | [Super Egg Drop](/problems/super-egg-drop) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/super_egg_drop/solution.py) |
  | 894 | [All Possible Full Binary Trees](/problems/all-possible-full-binary-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/all_possible_full_binary_trees/solution.py) |
  | 898 | [Bitwise ORs of Subarrays](/problems/bitwise-ors-of-subarrays) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/bitwise_ors_of_subarrays/solution.py) |
  | 902 | [Numbers At Most N Given Digit Set](/problems/numbers-at-most-n-given-digit-set) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/numbers_at_most_n_given_digit_set/solution.py) |
  | 903 | [Valid Permutations for DI Sequence](/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) |
  | 907 | [Sum of Subarray Minimums](/problems/sum-of-subarray-minimums) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_subarray_minimums/solution.py) |
  | 913 | [Cat and Mouse](/problems/cat-and-mouse) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cat_and_mouse/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) |
  | 920 | [Number of Music Playlists](/problems/number-of-music-playlists) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_music_playlists/solution.py) |
  | 926 | [Flip String to Monotone Increasing](/problems/flip-string-to-monotone-increasing) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flip_string_to_monotone_increasing/solution.py) |
  | 931 | [Minimum Falling Path Sum](/problems/minimum-falling-path-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_falling_path_sum/solution.py) |
  | 935 | [Knight Dialer](/problems/knight-dialer) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/knight_dialer/solution.py) |
  | 940 | [Distinct Subsequences II](/problems/distinct-subsequences-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/distinct_subsequences_ii/solution.py) |
  | 943 | [Find the Shortest Superstring](/problems/find-the-shortest-superstring) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_shortest_superstring/solution.py) |
  | 956 | [Tallest Billboard](/problems/tallest-billboard) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/tallest_billboard/solution.py) |
  | 960 | [Delete Columns to Make Sorted III](/problems/delete-columns-to-make-sorted-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_columns_to_make_sorted_iii/solution.py) |
  | 964 | [Least Operators to Express Number](/problems/least-operators-to-express-number) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/least_operators_to_express_number/solution.py) |
  | 968 | [Binary Tree Cameras](/problems/binary-tree-cameras) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_cameras/solution.py) |
  | 975 | [Odd Even Jump](/problems/odd-even-jumps) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/odd_even_jumps/solution.py) |
  | 978 | [Longest Turbulent Subarray](/problems/longest-turbulent-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_turbulent_subarray/solution.py) |
  | 979 | [Distribute Coins in Binary Tree](/problems/distribute-coins-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/distribute_coins_in_binary_tree/solution.py) |
  | 983 | [Minimum Cost For Tickets](/problems/minimum-cost-for-tickets) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_cost_for_tickets/solution.py) |
  | 996 | [Number of Squareful Arrays](/problems/number-of-squareful-arrays) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_squareful_arrays/solution.py) |
  | 1000 | [Minimum Cost to Merge Stones](/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) |
  | 1014 | [Best Sightseeing Pair](/problems/best-sightseeing-pair) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/best_sightseeing_pair/solution.py) |
  | 1035 | [Uncrossed Lines](/problems/uncrossed-lines) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/uncrossed_lines/solution.py) |
  | 1043 | [Partition Array for Maximum Sum](/problems/partition-array-for-maximum-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/partition_array_for_maximum_sum/solution.py) |
  | 1048 | [Longest String Chain](/problems/longest-string-chain) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_string_chain/solution.py) |
  | 1049 | [Last Stone Weight II](/problems/last-stone-weight-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/last_stone_weight_ii/solution.py) |
  | 1055 | [Shortest Way to Form String](/problems/shortest-way-to-form-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_way_to_form_string/solution.py) |
  | 1058 | [Minimize Rounding Error to Meet Target](/problems/minimize-rounding-error-to-meet-target) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimize_rounding_error_to_meet_target/solution.py) |
  | 1092 | [Shortest Common Supersequence](/problems/shortest-common-supersequence) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_common_supersequence/solution.py) |
  | 1105 | [Filling Bookcase Shelves](/problems/filling-bookcase-shelves) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/filling_bookcase_shelves/solution.py) |
  | 1137 | [N-th Tribonacci Number](/problems/n-th-tribonacci-number) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/n_th_tribonacci_number/solution.py) |
  | 1140 | [Stone Game II](/problems/stone-game-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/stone_game_ii/solution.py) |
  | 1143 | [Longest Common Subsequence](/problems/longest-common-subsequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_common_subsequence/solution.py) |
  | 1155 | [Number of Dice Rolls With Target Sum](/problems/number-of-dice-rolls-with-target-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_dice_rolls_with_target_sum/solution.py) |
  | 1162 | [As Far from Land as Possible](/problems/as-far-from-land-as-possible) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/as_far_from_land_as_possible/solution.py) |
  | 1216 | [Valid Palindrome III](/problems/valid-palindrome-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/valid_palindrome_iii/solution.py) |
  | 1220 | [Count Vowels Permutation](/problems/count-vowels-permutation) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_vowels_permutation/solution.py) |
  | 1230 | [Toss Strange Coins](/problems/toss-strange-coins) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/toss_strange_coins/solution.py) |
  | 1235 | [Maximum Profit in Job Scheduling](/problems/maximum-profit-in-job-scheduling) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_profit_in_job_scheduling/solution.py) |
  | 1246 | [Palindrome Removal](/problems/palindrome-removal) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/palindrome_removal/solution.py) |
  | 1255 | [Maximum Score Words Formed by Letters](/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) |
  | 1259 | [Handshakes That Don't Cross](/problems/handshakes-that-dont-cross) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/handshakes_that_dont_cross/solution.py) |
  | 1269 | [Number of Ways to Stay in the Same Place After Some Steps](/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_ways_to_stay_in_the_same_place_after_some_steps/solution.py) |
  | 1277 | [Count Square Submatrices with All Ones](/problems/count-square-submatrices-with-all-ones) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_square_submatrices_with_all_ones/solution.py) |
  | 1289 | [Minimum Falling Path Sum II](/problems/minimum-falling-path-sum-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_falling_path_sum_ii/solution.py) |
  | 1334 | [Find the City With the Smallest Number of Neighbors at a Threshold Distance](/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_city_with_the_smallest_number_of_neighbors_at_a_threshold_distance/solution.py) |
  | 1335 | [Minimum Difficulty of a Job Schedule](/problems/minimum-difficulty-of-a-job-schedule) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_difficulty_of_a_job_schedule/solution.py) |
  | 1359 | [Count All Valid Pickup and Delivery Options](/problems/count-all-valid-pickup-and-delivery-options) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_all_valid_pickup_and_delivery_options/solution.py) |
</div>

Pages: 1, [2](/catalog/topics/dynamic-programming-2)


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