Python solutions for data structures, algorithms, and LeetCode practice problems. The repository is organized by topic so related patterns are easy to review together.
.
├── arrays/
│ ├── lc_1_two_sum.py
│ ├── lc_39_combination_sum.py
│ ├── lc_46_permutations.py
│ ├── lc_78_subsets.py
│ ├── lc_877_stone_game.py
│ ├── lc_1140_stone_game_II.py
│ ├── lc_1291_sequential_digits.py
│ ├── lc_1331_rank_transform_of_an_array.py
│ ├── lc_1406_stone_game_III.py
│ ├── lc_1464_maximum_product_of_two_elements_in_an_array.py
│ ├── lc_1477_find_two_non_overlapping_sub_arrays_each_with_target_sum.py
│ ├── lc_1510_stone_game_IV.py
│ ├── lc_1658_minimum_operations_to_reduce_x_to_zero.py
│ ├── lc_1979_greatest_common_divisor_of_array.py
│ ├── lc_2069_walking_robot_simulation_II.py
│ ├── lc_2091_removing_minimum_and_maximum.py
│ ├── lc_2574_left_and_right_sum_differences.py
│ ├── lc_2948_make_lexicographically_smallest_array_by_swapping_elements.py
│ ├── lc_3069_distribute_elements_into_two_arrays_I.py
│ ├── lc_3483_unique-3-digit-even-numbers.py
│ ├── lc_3524_find_x_value_of_array_I.py
│ ├── lc_3689_maximum_total_subarray_value_I.py
│ ├── lc_3731_find_missing_elements.py
│ ├── lc_3903_smallest_stable_index_I.py
│ └── lc_3904_smallest_stable_index_II.py
├── binary-search/
│ └── lc_154_rotated_sorted_arrayII.py
├── binary-trees/
│ ├── lc_2196_create_binary_trees_from_description.py
│ └── lc_2265_count_nodes_equal_to_average_of_subtree.py
├── DSA quest/
│ ├── Array I/
│ │ ├── Q1.py
│ │ ├── Q2.py
│ │ └── Q3.py
│ ├── Array II/
│ │ ├── Q1.py
│ │ ├── Q2.py
│ │ └── Q3.py
│ ├── Monotonic Stack I/
│ │ └── Q1.py
│ └── Stack /
│ ├── Q1.py
│ ├── Q2.py
│ └── Q3.py
├── strings/
│ ├── lc_32_longest_valid_parentheses.py
│ ├── lc_1520_maximum_number_of_non_overlapping_substrings.py
│ ├── lc_3014_minimum_number_of_pushes_to_type_word_I.py
│ ├── lc_3090_maximum_length_substring.py
│ ├── lc_3345_smallest_divisible_digit_product_I.py
│ ├── lc_3498_reverse_degree_of_a_string.py
│ ├── lc_3517_smallest_palindromic_rearrangement_I.py
│ ├── lc_3612_process_string_with_special_operations.py
│ └── lc_3751_total_waviness_of_numbers_in_range_I.py
├── lc_836_rectangle_overlap.py
├── lc_1288_remove_covered_intervals.py
├── lc_1401_circles_and_rectangles_overlapping.py
├── lc_1621_number_of_sets_of_k_overlapping_line_segments.py
├── lc_3336_subsequences_with_equal_gcd.py
├── lc_3622_check_divisibility_by_digit_sum_and_product.py
├── lc_3754_concatenate_non_zero_digits_and_multiply_by_sum_I.py
├── lc_3756_concatenate_non_zero_digits_and_multiply_by_sum_II.py
├── lc_3870_count_commas_in_range_I.py
├── lc_3871_count_commas_in_range_II.py
└── practice.ipynb
| File | Problem |
|---|---|
arrays/lc_1_two_sum.py |
LeetCode 1: Two Sum |
arrays/lc_39_combination_sum.py |
LeetCode 39: Combination Sum |
arrays/lc_46_permutations.py |
LeetCode 46: Permutations |
arrays/lc_78_subsets.py |
LeetCode 78: Subsets |
arrays/lc_877_stone_game.py |
LeetCode 877: Stone Game |
arrays/lc_1140_stone_game_II.py |
LeetCode 1140: Stone Game II |
arrays/lc_1291_sequential_digits.py |
LeetCode 1291: Sequential Digits |
arrays/lc_1331_rank_transform_of_an_array.py |
LeetCode 1331: Rank Transform of an Array |
arrays/lc_1406_stone_game_III.py |
LeetCode 1406: Stone Game III |
arrays/lc_1464_maximum_product_of_two_elements_in_an_array.py |
LeetCode 1464: Maximum Product of Two Elements in an Array |
arrays/lc_1477_find_two_non_overlapping_sub_arrays_each_with_target_sum.py |
LeetCode 1477: Find Two Non-overlapping Sub-arrays Each With Target Sum |
arrays/lc_1510_stone_game_IV.py |
LeetCode 1510: Stone Game IV |
arrays/lc_1658_minimum_operations_to_reduce_x_to_zero.py |
LeetCode 1658: Minimum Operations to Reduce X to Zero |
arrays/lc_1979_greatest_common_divisor_of_array.py |
LeetCode 1979: Find Greatest Common Divisor of Array |
arrays/lc_2069_walking_robot_simulation_II.py |
LeetCode 2069: Walking Robot Simulation II |
arrays/lc_2091_removing_minimum_and_maximum.py |
LeetCode 2091: Removing Minimum and Maximum From Array |
arrays/lc_2574_left_and_right_sum_differences.py |
LeetCode 2574: Left and Right Sum Differences |
arrays/lc_2948_make_lexicographically_smallest_array_by_swapping_elements.py |
LeetCode 2948: Make Lexicographically Smallest Array by Swapping Elements |
arrays/lc_3069_distribute_elements_into_two_arrays_I.py |
LeetCode 3069: Distribute Elements Into Two Arrays I |
arrays/lc_3483_unique-3-digit-even-numbers.py |
LeetCode 3483: Unique 3-Digit Even Numbers |
arrays/lc_3524_find_x_value_of_array_I.py |
LeetCode 3524: Find X Value of Array I |
arrays/lc_3689_maximum_total_subarray_value_I.py |
LeetCode 3689: Maximum Total Subarray Value I |
arrays/lc_3731_find_missing_elements.py |
LeetCode 3731: Find Missing Elements |
arrays/lc_3903_smallest_stable_index_I.py |
LeetCode 3903: Smallest Stable Index I |
arrays/lc_3904_smallest_stable_index_II.py |
LeetCode 3904: Smallest Stable Index II |
| File | Problem |
|---|---|
binary-search/lc_154_rotated_sorted_arrayII.py |
LeetCode 154: Find Minimum in Rotated Sorted Array II |
| File | Problem |
|---|---|
binary-trees/lc_2196_create_binary_trees_from_description.py |
LeetCode 2196: Create Binary Tree From Descriptions |
binary-trees/lc_2265_count_nodes_equal_to_average_of_subtree.py |
LeetCode 2265: Count Nodes Equal to Average of Subtree |
| File | Problem |
|---|---|
strings/lc_32_longest_valid_parentheses.py |
LeetCode 32: Longest Valid Parentheses |
strings/lc_1520_maximum_number_of_non_overlapping_substrings.py |
LeetCode 1520: Maximum Number of Non-Overlapping Substrings |
strings/lc_3014_minimum_number_of_pushes_to_type_word_I.py |
LeetCode 3014: Minimum Number of Pushes to Type Word I |
strings/lc_3090_maximum_length_substring.py |
LeetCode 3090: Maximum Length Substring with Two Occurrences |
strings/lc_3345_smallest_divisible_digit_product_I.py |
LeetCode 3345: Smallest Divisible Digit Product I |
strings/lc_3498_reverse_degree_of_a_string.py |
LeetCode 3498: Reverse Degree of a String |
strings/lc_3517_smallest_palindromic_rearrangement_I.py |
LeetCode 3517: Smallest Palindromic Rearrangement I |
strings/lc_3612_process_string_with_special_operations.py |
LeetCode 3612: Process String with Special Operations I |
strings/lc_3751_total_waviness_of_numbers_in_range_I.py |
LeetCode 3751: Total Waviness of Numbers in Range I |
| File | Problem |
|---|---|
lc_836_rectangle_overlap.py |
LeetCode 836: Rectangle Overlap |
lc_1288_remove_covered_intervals.py |
LeetCode 1288: Remove Covered Intervals |
lc_1401_circles_and_rectangles_overlapping.py |
LeetCode 1401: Circle and Rectangle Overlapping |
lc_1621_number_of_sets_of_k_overlapping_line_segments.py |
LeetCode 1621: Number of Sets of K Non-Overlapping Line Segments |
lc_3336_subsequences_with_equal_gcd.py |
LeetCode 3336: Find the Number of Subsequences With Equal GCD |
lc_3622_check_divisibility_by_digit_sum_and_product.py |
LeetCode 3622: Check Divisibility by Digit Sum and Product |
lc_3754_concatenate_non_zero_digits_and_multiply_by_sum_I.py |
LeetCode 3754: Concatenate Non-Zero Digits and Multiply by Sum I |
lc_3756_concatenate_non_zero_digits_and_multiply_by_sum_II.py |
LeetCode 3756: Concatenate Non-Zero Digits and Multiply by Sum II |
lc_3870_count_commas_in_range_I.py |
LeetCode 3870: Count Commas in Range I |
lc_3871_count_commas_in_range_II.py |
LeetCode 3871: Count Commas in Range II |
| Folder | Contents |
|---|---|
DSA quest/Array I/ |
Practice questions Q1.py to Q3.py |
DSA quest/Array II/ |
Practice questions Q1.py to Q3.py |
DSA quest/Monotonic Stack I/ |
Practice question Q1.py |
DSA quest/Stack / |
Practice questions Q1.py to Q3.py |
LeetCode solution files generally use:
lc_<problem_number>_<problem_slug>.py
This keeps files searchable by problem number, title, and topic.