Updating exercises
This commit is contained in:
161
README.md
161
README.md
@@ -4,7 +4,6 @@ This repo tracks my journey solving LeetCode problems — not just code, but my
|
||||
|
||||
[](https://leetcode.com/u/cargdev/)
|
||||
[](https://www.python.org/)
|
||||
[](https://www.typescriptlang.org/)
|
||||
[](LICENSE)
|
||||
[](https://github.com/CarGDev/leetcode/commits/master)
|
||||
[](https://github.com/CarGDev/leetcode)
|
||||
@@ -23,89 +22,87 @@ This repo tracks my journey solving LeetCode problems — not just code, but my
|
||||
|
||||
## 🗂 Directory Structure
|
||||
- `src/exercises/`: Auto-downloaded solutions via Cursor
|
||||
- `src/notes/`: My personal notes, approaches, and learning reflections
|
||||
|
||||
## 🧩 Problem Index
|
||||
|
||||
| # | Title | Difficulty | Notes |
|
||||
|---|-------|------------|-------|
|
||||
| 001 | [Two Sum](src/exercises/1.two-sum.py) | Easy | [View Notes](src/notes/001_two_sum.md) |
|
||||
| 002 | [Add Two Numbers](src/exercises/2.add-two-numbers.py) | Medium | [View Notes](src/notes/002_add_two_numbers.md) |
|
||||
| 003 | [Longest Substring Without Repeating Characters](src/exercises/3.longest-substring-without-repeating-characters.py) | Medium | [View Notes](src/notes/003_longest_substring_without_repeating_characters.md) |
|
||||
| 004 | [Median of Two Sorted Arrays](src/exercises/4.median-of-two-sorted-arrays.py) | Hard | [View Notes](src/notes/004_median_of_two_sorted_arrays.md) |
|
||||
| 005 | [Longest Palindromic Substring](src/exercises/5.longest-palindromic-substring.py) | Medium | [View Notes](src/notes/005_longest_palindromic_substring.md) |
|
||||
| 006 | [Zigzag Conversion](src/exercises/6.zigzag-conversion.py) | Medium | [View Notes](src/notes/006_zigzag_conversion.md) |
|
||||
| 007 | [Reverse Integer](src/exercises/7.reverse-integer.py) | Medium | [View Notes](src/notes/007_reverse_integer.md) |
|
||||
| 009 | [Palindrome Number](src/exercises/9.palindrome-number.py) | Easy | [View Notes](src/notes/009_palindrome_number.md) |
|
||||
| 010 | [Regular Expression Matching](src/exercises/10.regular-expression-matching.py) | Hard | [View Notes](src/notes/010_regular_expression_matching.md) |
|
||||
| 011 | [Container With Most Water](src/exercises/11.container-with-most-water.py) | Medium | [View Notes](src/notes/011_container_with_most_water.md) |
|
||||
| 013 | [Roman to Integer](src/exercises/13.roman-to-integer.py) | Easy | [View Notes](src/notes/013_roman_to_integer.md) |
|
||||
| 014 | [Longest Common Prefix](src/exercises/14.longest-common-prefix.py) | Easy | [View Notes](src/notes/014_longest_common_prefix.md) |
|
||||
| 015 | [3Sum](src/exercises/15.3sum.py) | Medium | [View Notes](src/notes/015_3sum.md) |
|
||||
| 020 | [Valid Parentheses](src/exercises/20.valid-parentheses.py) | Easy | [View Notes](src/notes/020_valid_parentheses.md) |
|
||||
| 021 | [Merge Two Sorted Lists](src/exercises/21.merge-two-sorted-lists.py) | Easy | [View Notes](src/notes/021_merge_two_sorted_lists.md) |
|
||||
| 022 | [Generate Parentheses](src/exercises/22.generate-parentheses.py) | Medium | [View Notes](src/notes/022_generate_parentheses.md) |
|
||||
| 028 | [Find the Index of the First Occurrence in a String](src/exercises/28.find-the-index-of-the-first-occurrence-in-a-string.py) | Easy | [View Notes](src/notes/028_find_the_index_of_the_first_occurrence_in_a_string.md) |
|
||||
| 035 | [Search Insert Position](src/exercises/35.search-insert-position.py) | Easy | [View Notes](src/notes/035_search_insert_position.md) |
|
||||
| 036 | [Valid Sudoku](src/exercises/36.valid-sudoku.py) | Medium | [View Notes](src/notes/036_valid_sudoku.md) |
|
||||
| 042 | [Trapping Rain Water](src/exercises/42.trapping-rain-water.py) | Hard | [View Notes](src/notes/042_trapping_rain_water.md) |
|
||||
| 045 | [Jump Game II](src/exercises/45.jump-game-ii.py) | Medium | [View Notes](src/notes/045_jump_game_ii.md) |
|
||||
| 050 | [Pow(x, n)](src/exercises/50.powx-n.py) | Medium | [View Notes](src/notes/050_powx_n.md) |
|
||||
| 055 | [Jump Game](src/exercises/55.jump-game.py) | Medium | [View Notes](src/notes/055_jump_game.md) |
|
||||
| 066 | [Plus One](src/exercises/66.plus-one.py) | Easy | [View Notes](src/notes/066_plus_one.md) |
|
||||
| 069 | [Sqrt(x)](src/exercises/69.sqrtx.py) | Easy | [View Notes](src/notes/069_sqrtx.md) |
|
||||
| 074 | [Search a 2D Matrix](src/exercises/74.search-a-2d-matrix.py) | Medium | [View Notes](src/notes/074_search_a_2d_matrix.md) |
|
||||
| 080 | [Remove Duplicates from Sorted Array II](src/exercises/80.remove-duplicates-from-sorted-array-ii.py) | Medium | [View Notes](src/notes/080_remove_duplicates_from_sorted_array_ii.md) |
|
||||
| 088 | [Merge Sorted Array](src/exercises/88.merge-sorted-array.py) | Easy | [View Notes](src/notes/088_merge_sorted_array.md) |
|
||||
| 089 | [Gray Code](src/exercises/89.gray-code.py) | Medium | [View Notes](src/notes/089_gray_code.md) |
|
||||
| 090 | [Subsets II](src/exercises/90.subsets-ii.py) | Medium | [View Notes](src/notes/090_subsets_ii.md) |
|
||||
| 091 | [Decode Ways](src/exercises/91.decode-ways.py) | Medium | [View Notes](src/notes/091_decode_ways.md) |
|
||||
| 092 | [Reverse Linked List II](src/exercises/92.reverse-linked-list-ii.py) | Medium | [View Notes](src/notes/092_reverse_linked_list_ii.md) |
|
||||
| 121 | [Best Time to Buy and Sell Stock](src/exercises/121.best-time-to-buy-and-sell-stock.py) | Easy | [View Notes](src/notes/121_best_time_to_buy_and_sell_stock.md) |
|
||||
| 122 | [Best Time to Buy and Sell Stock II](src/exercises/122.best-time-to-buy-and-sell-stock-ii.py) | Medium | [View Notes](src/notes/122_best_time_to_buy_and_sell_stock_ii.md) |
|
||||
| 125 | [Valid Palindrome](src/exercises/125.valid-palindrome.py) | Easy | [View Notes](src/notes/125_valid_palindrome.md) |
|
||||
| 128 | [Longest Consecutive Sequence](src/exercises/128.longest-consecutive-sequence.py) | Medium | [View Notes](src/notes/128_longest_consecutive_sequence.md) |
|
||||
| 135 | [Candy](src/exercises/135.candy.py) | Hard | [View Notes](src/notes/135_candy.md) |
|
||||
| 141 | [Linked List Cycle](src/exercises/141.linked-list-cycle.py) | Easy | [View Notes](src/notes/141_linked_list_cycle.md) |
|
||||
| 149 | [Max Points on a Line](src/exercises/149.max-points-on-a-line.py) | Hard | [View Notes](src/notes/149_max_points_on_a_line.md) |
|
||||
| 150 | [Evaluate Reverse Polish Notation](src/exercises/150.evaluate-reverse-polish-notation.py) | Medium | [View Notes](src/notes/150_evaluate_reverse_polish_notation.md) |
|
||||
| 153 | [Find Minimum in Rotated Sorted Array](src/exercises/153.find-minimum-in-rotated-sorted-array.py) | Medium | [View Notes](src/notes/153_find_minimum_in_rotated_sorted_array.md) |
|
||||
| 155 | [Min Stack](src/exercises/155.min-stack.py) | Medium | [View Notes](src/notes/155_min_stack.md) |
|
||||
| 167 | [Two Sum II - Input Array Is Sorted](src/exercises/167.two-sum-ii-input-array-is-sorted.py) | Medium | [View Notes](src/notes/167_two_sum_ii_input_array_is_sorted.md) |
|
||||
| 169 | [Majority Element](src/exercises/169.majority-element.py) | Easy | [View Notes](src/notes/169_majority_element.md) |
|
||||
| 172 | [Factorial Trailing Zeroes](src/exercises/172.factorial-trailing-zeroes.py) | Medium | [View Notes](src/notes/172_factorial_trailing_zeroes.md) |
|
||||
| 189 | [Rotate Array](src/exercises/189.rotate-array.py) | Medium | [View Notes](src/notes/189_rotate_array.md) |
|
||||
| 202 | [Happy Number](src/exercises/202.happy-number.py) | Easy | [View Notes](src/notes/202_happy_number.md) |
|
||||
| 205 | [Isomorphic Strings](src/exercises/205.isomorphic-strings.py) | Easy | [View Notes](src/notes/205_isomorphic_strings.md) |
|
||||
| 206 | [Reverse Linked List](src/exercises/206.reverse-linked-list.py) | Easy | [View Notes](src/notes/206_reverse_linked_list.md) |
|
||||
| 217 | [Contains Duplicate](src/exercises/217.contains-duplicate.py) | Easy | [View Notes](src/notes/217_contains_duplicate.md) |
|
||||
| 219 | [Contains Duplicate II](src/exercises/219.contains-duplicate-ii.py) | Easy | [View Notes](src/notes/219_contains_duplicate_ii.md) |
|
||||
| 228 | [Summary Ranges](src/exercises/228.summary-ranges.py) | Easy | [View Notes](src/notes/228_summary_ranges.md) |
|
||||
| 238 | [Product of Array Except Self](src/exercises/238.product-of-array-except-self.py) | Medium | [View Notes](src/notes/238_product_of_array_except_self.md) |
|
||||
| 242 | [Valid Anagram](src/exercises/242.valid-anagram.py) | Easy | [View Notes](src/notes/242_valid_anagram.md) |
|
||||
| 243 | [Shortest Word Distance](src/exercises/243.shortest-word-distance.py) | Easy | [View Notes](src/notes/243_shortest_word_distance.md) |
|
||||
| 244 | [Shortest Word Distance II](src/exercises/244.shortest-word-distance-ii.py) | Medium | [View Notes](src/notes/244_shortest_word_distance_ii.md) |
|
||||
| 245 | [Shortest Word Distance III](src/exercises/245.shortest-word-distance-iii.py) | Medium | [View Notes](src/notes/245_shortest_word_distance_iii.md) |
|
||||
| 246 | [Strobogrammatic Number](src/exercises/246.strobogrammatic-number.py) | Easy | [View Notes](src/notes/246_strobogrammatic_number.md) |
|
||||
| 248 | [Strobogrammatic Number III](src/exercises/248.strobogrammatic-number-iii.py) | Hard | [View Notes](src/notes/248_strobogrammatic_number_iii.md) |
|
||||
| 290 | [Word Pattern](src/exercises/290.word-pattern.py) | Easy | [View Notes](src/notes/290_word_pattern.md) |
|
||||
| 383 | [Ransom Note](src/exercises/383.ransom-note.py) | Easy | [View Notes](src/notes/383_ransom_note.md) |
|
||||
| 392 | [Is Subsequence](src/exercises/392.is-subsequence.py) | Easy | [View Notes](src/notes/392_is_subsequence.md) |
|
||||
| 704 | [Binary Search](src/exercises/704.binary-search.py) | Easy | [View Notes](src/notes/704_binary_search.md) |
|
||||
| 875 | [Koko Eating Bananas](src/exercises/875.koko-eating-bananas.py) | Medium | [View Notes](src/notes/875_koko_eating_bananas.md) |
|
||||
| 990 | [Satisfiability of Equality Equations](src/exercises/990.satisfiability-of-equality-equations.py) | Medium | [View Notes](src/notes/990_satisfiability_of_equality_equations.md) |
|
||||
| 1200 | [Minimum Absolute Difference](src/exercises/1200.minimum-absolute-difference.py) | Easy | [View Notes](src/notes/1200_minimum_absolute_difference.md) |
|
||||
| 1298 | [Maximum Candies You Can Get from Boxes](src/exercises/1298.maximum-candies-you-can-get-from-boxes.py) | Medium | [View Notes](src/notes/1298_maximum_candies_you_can_get_from_boxes.md) |
|
||||
| 1820 | [Maximum Number of Accepted Invitations](src/exercises/1820.maximum-number-of-accepted-invitations.py) | Medium | [View Notes](src/notes/1820_maximum_number_of_accepted_invitations.md) |
|
||||
| 2040 | [Kth Smallest Product of Two Sorted Arrays](src/exercises/2040.kth-smallest-product-of-two-sorted-arrays.py) | Medium | [View Notes](src/notes/2040_kth_smallest_product_of_two_sorted_arrays.md) |
|
||||
| 2053 | [Kth Distinct String in an Array](src/exercises/2053.kth-distinct-string-in-an-array.py) | Easy | [View Notes](src/notes/2053_kth_distinct_string_in_an_array.md) |
|
||||
| 2116 | [Check if a Parentheses String Can Be Valid](src/exercises/2116.check-if-a-parentheses-string-can-be-valid.py) | Medium | [View Notes](src/notes/2116_check_if_a_parentheses_string_can_be_valid.md) |
|
||||
| 2294 | [Partition Array Such That Maximum Difference Is K](src/exercises/2294.partition-array-such-that-maximum-difference-is-k.py) | Medium | [View Notes](src/notes/2294_partition_array_such_that_maximum_difference_is_k.md) |
|
||||
| 2441 | [Largest Positive Integer That Exists With Its Negative](src/exercises/2441.largest-positive-integer-that-exists-with-its-negative.py) | Easy | [View Notes](src/notes/2441_largest_positive_integer_that_exists_with_its_negative.md) |
|
||||
| 2616 | [Minimize the Maximum Difference of Pairs](src/exercises/2616.minimize-the-maximum-difference-of-pairs.py) | Medium | [View Notes](src/notes/2616_minimize_the_maximum_difference_of_pairs.md) |
|
||||
| 2966 | [Divide Array Into Arrays With Max Difference](src/exercises/2966.divide-array-into-arrays-with-max-difference.py) | Medium | [View Notes](src/notes/2966_divide_array_into_arrays_with_max_difference.md) |
|
||||
| 3442 | [Maximum Difference Between Even and Odd Frequency I](src/exercises/3442.maximum-difference-between-even-and-odd-frequency-i.py) | Easy | [View Notes](src/notes/3442_maximum_difference_between_even_and_odd_frequency_i.md) |
|
||||
| 3445 | [Maximum Difference Between Even and Odd Frequency II](src/exercises/3445.maximum-difference-between-even-and-odd-frequency-ii.py) | Easy | [View Notes](src/notes/3445_maximum_difference_between_even_and_odd_frequency_ii.md) |
|
||||
| # | LeetCode # | Title | Difficulty | Technology |
|
||||
|---|------------|-------|------------|------------|
|
||||
| 1 | 001 | [Two Sum](src/exercises/1.two-sum.py) | Easy | Python |
|
||||
| 2 | 002 | [Add Two Numbers](src/exercises/2.add-two-numbers.py) | Medium | Python |
|
||||
| 3 | 003 | [Longest Substring Without Repeating Characters](src/exercises/3.longest-substring-without-repeating-characters.py) | Medium | Python |
|
||||
| 4 | 004 | [Median of Two Sorted Arrays](src/exercises/4.median-of-two-sorted-arrays.py) | Hard | Python |
|
||||
| 5 | 005 | [Longest Palindromic Substring](src/exercises/5.longest-palindromic-substring.py) | Medium | Python |
|
||||
| 6 | 009 | [Palindrome Number](src/exercises/9.palindrome-number.py) | Easy | Python |
|
||||
| 8 | 011 | [Container With Most Water](src/exercises/11.container-with-most-water.py) | Medium | Python |
|
||||
| 9 | 013 | [Roman to Integer](src/exercises/13.roman-to-integer.py) | Easy | Python |
|
||||
| 10 | 014 | [Longest Common Prefix](src/exercises/14.longest-common-prefix.py) | Easy | Python |
|
||||
| 11 | 015 | [3Sum](src/exercises/15.3sum.py) | Medium | Python |
|
||||
| 12 | 020 | [Valid Parentheses](src/exercises/20.valid-parentheses.py) | Easy | Python |
|
||||
| 14 | 022 | [Generate Parentheses](src/exercises/22.generate-parentheses.py) | Medium | Python |
|
||||
| 15 | 026 | [Remove Duplicates from Sorted Array](src/exercises/26.remove-duplicates-from-sorted-array.py) | Easy | Python |
|
||||
| 16 | 027 | [Remove Element](src/exercises/27.remove-element.py) | Easy | Python |
|
||||
| 17 | 028 | [Find the Index of the First Occurrence in a String](src/exercises/28.find-the-index-of-the-first-occurrence-in-a-string.py) | Easy | Python |
|
||||
| 18 | 035 | [Search Insert Position](src/exercises/35.search-insert-position.py) | Easy | Python |
|
||||
| 19 | 036 | [Valid Sudoku](src/exercises/36.valid-sudoku.py) | Medium | Python |
|
||||
| 20 | 042 | [Trapping Rain Water](src/exercises/42.trapping-rain-water.py) | Hard | Python |
|
||||
| 22 | 049 | [Group Anagrams](src/exercises/49.group-anagrams.js) | Medium | JavaScript |
|
||||
| 23 | 050 | [Pow(x, n)](src/exercises/50.powx-n.py) | Medium | Python |
|
||||
| 24 | 055 | [Jump Game](src/exercises/55.jump-game.py) | Medium | Python |
|
||||
| 24 | 595 | [Big Countries](src/exercises/595.big-countries.sql) | Easy | SQL |
|
||||
| 25 | 058 | [Length of Last Word](src/exercises/58.length-of-last-word.py) | Easy | Python |
|
||||
| 26 | 066 | [Plus One](src/exercises/66.plus-one.py) | Easy | Python |
|
||||
| 27 | 069 | [Sqrt(x)](src/exercises/69.sqrtx.py) | Easy | Python |
|
||||
| 28 | 070 | [Climbing Stairs](src/exercises/70.climbing-stairs.js) | Easy | JavaScript |
|
||||
| 29 | 074 | [Search a 2D Matrix](src/exercises/74.search-a-2d-matrix.py) | Medium | Python |
|
||||
| 30 | 080 | [Remove Duplicates from Sorted Array II](src/exercises/80.remove-duplicates-from-sorted-array-ii.py) | Medium | Python |
|
||||
| 31 | 088 | [Merge Sorted Array](src/exercises/88.merge-sorted-array.py) | Easy | Python |
|
||||
| 32 | 089 | [Gray Code](src/exercises/89.gray-code.py) | Medium | Python |
|
||||
| 33 | 090 | [Subsets II](src/exercises/90.subsets-ii.py) | Medium | Python |
|
||||
| 34 | 091 | [Decode Ways](src/exercises/91.decode-ways.py) | Medium | Python |
|
||||
| 36 | 121 | [Best Time to Buy and Sell Stock](src/exercises/121.best-time-to-buy-and-sell-stock.py) | Easy | Python |
|
||||
| 37 | 122 | [Best Time to Buy and Sell Stock II](src/exercises/122.best-time-to-buy-and-sell-stock-ii.py) | Medium | Python |
|
||||
| 38 | 125 | [Valid Palindrome](src/exercises/125.valid-palindrome.py) | Easy | Python |
|
||||
| 39 | 128 | [Longest Consecutive Sequence](src/exercises/128.longest-consecutive-sequence.py) | Medium | Python |
|
||||
| 40 | 1302 | [Deepest Leaves Sum](src/exercises/1302.deepest-leaves-sum.py) | Medium | Python |
|
||||
| 41 | 135 | [Candy](src/exercises/135.candy.py) | Hard | Python |
|
||||
| 42 | 141 | [Linked List Cycle](src/exercises/141.linked-list-cycle.py) | Easy | Python |
|
||||
| 43 | 149 | [Max Points on a Line](src/exercises/149.max-points-on-a-line.py) | Hard | Python |
|
||||
| 45 | 151 | [Reverse Words in a String](src/exercises/151.reverse-words-in-a-string.py) | Medium | Python |
|
||||
| 46 | 153 | [Find Minimum in Rotated Sorted Array](src/exercises/153.find-minimum-in-rotated-sorted-array.py) | Medium | Python |
|
||||
| 47 | 155 | [Min Stack](src/exercises/155.min-stack.py) | Medium | Python |
|
||||
| 48 | 167 | [Two Sum II - Input Array Is Sorted](src/exercises/167.two-sum-ii-input-array-is-sorted.py) | Medium | Python |
|
||||
| 49 | 169 | [Majority Element](src/exercises/169.majority-element.py) | Easy | Python |
|
||||
| 50 | 172 | [Factorial Trailing Zeroes](src/exercises/172.factorial-trailing-zeroes.py) | Medium | Python |
|
||||
| 51 | 189 | [Rotate Array](src/exercises/189.rotate-array.py) | Medium | Python |
|
||||
| 52 | 202 | [Happy Number](src/exercises/202.happy-number.py) | Easy | Python |
|
||||
| 53 | 205 | [Isomorphic Strings](src/exercises/205.isomorphic-strings.py) | Easy | Python |
|
||||
| 54 | 2053 | [Kth Distinct String in an Array](src/exercises/2053.kth-distinct-string-in-an-array.py) | Easy | Python |
|
||||
| 55 | 206 | [Reverse Linked List](src/exercises/206.reverse-linked-list.py) | Easy | Python |
|
||||
| 56 | 217 | [Contains Duplicate](src/exercises/217.contains-duplicate.py) | Easy | Python |
|
||||
| 57 | 219 | [Contains Duplicate II](src/exercises/219.contains-duplicate-ii.py) | Easy | Python |
|
||||
| 58 | 228 | [Summary Ranges](src/exercises/228.summary-ranges.py) | Easy | Python |
|
||||
| 59 | 238 | [Product of Array Except Self](src/exercises/238.product-of-array-except-self.py) | Medium | Python |
|
||||
| 60 | 242 | [Valid Anagram](src/exercises/242.valid-anagram.py) | Easy | Python |
|
||||
| 61 | 243 | [Shortest Word Distance](src/exercises/243.shortest-word-distance.py) | Easy | Python |
|
||||
| 62 | 244 | [Shortest Word Distance II](src/exercises/244.shortest-word-distance-ii.py) | Medium | Python |
|
||||
| 63 | 245 | [Shortest Word Distance III](src/exercises/245.shortest-word-distance-iii.py) | Medium | Python |
|
||||
| 64 | 246 | [Strobogrammatic Number](src/exercises/246.strobogrammatic-number.py) | Easy | Python |
|
||||
| 65 | 248 | [Strobogrammatic Number III](src/exercises/248.strobogrammatic-number-iii.py) | Hard | Python |
|
||||
| 66 | 271 | [Encode and Decode Strings](src/exercises/271.encode-and-decode-strings.js) | Medium | JavaScript |
|
||||
| 67 | 290 | [Word Pattern](src/exercises/290.word-pattern.py) | Easy | Python |
|
||||
| 69 | 347 | [Top K Frequent Elements](src/exercises/347.top-k-frequent-elements.js) | Medium | JavaScript |
|
||||
| 70 | 383 | [Ransom Note](src/exercises/383.ransom-note.py) | Easy | Python |
|
||||
| 71 | 392 | [Is Subsequence](src/exercises/392.is-subsequence.py) | Easy | Python |
|
||||
| 72 | 704 | [Binary Search](src/exercises/704.binary-search.py) | Easy | Python |
|
||||
| 73 | 760 | [Find Anagram Mappings](src/exercises/760.find-anagram-mappings.py) | Easy | Python |
|
||||
| 74 | 875 | [Koko Eating Bananas](src/exercises/875.koko-eating-bananas.py) | Medium | Python |
|
||||
| 76 | 1048 | [Longest String Chain](src/exercises/1048.longest-string-chain.js) | Medium | JavaScript |
|
||||
| 77 | 1200 | [Minimum Absolute Difference](src/exercises/1200.minimum-absolute-difference.py) | Easy | Python |
|
||||
| 80 | 2016 | [Maximum Difference Between Increasing Elements](src/exercises/2016.maximum-difference-between-increasing-elements.py) | Easy | Python |
|
||||
| 83 | 2294 | [Partition Array Such That Maximum Difference Is K](src/exercises/2294.partition-array-such-that-maximum-difference-is-k.py) | Medium | Python |
|
||||
| 85 | 3442 | [Maximum Difference Between Even and Odd Frequency I](src/exercises/3442.maximum-difference-between-even-and-odd-frequency-i.py) | Easy | Python |
|
||||
| 87 | 3582 | [Generate Tag for Video Caption](src/exercises/3582.generate-tag-for-video-caption.py) | Easy | Python |
|
||||
| 88 | 3583 | [Count Special Triplets](src/exercises/3583.count-special-triplets.py) | Easy | Python |
|
||||
|
||||
## 🛠️ Tools & Scripts
|
||||
- `create_missing_notes.sh`: Automatically creates missing note files for solved problems
|
||||
@@ -136,4 +133,4 @@ This repo tracks my journey solving LeetCode problems — not just code, but my
|
||||
|
||||
---
|
||||
|
||||
*This repository is a living document of my algorithmic learning journey. Each note captures my thought process, mistakes, and insights.*
|
||||
*This repository is a living document of my algorithmic learning journey. Each note captures my thought process, mistakes, and insights.*
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def isMatch(self, s: str, p: str) -> bool:
|
||||
|
||||
# @leet end
|
||||
@@ -1,40 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def maxCandies(self, status: List[int], candies: List[int], keys: List[List[int]], containedBoxes: List[List[int]], initialBoxes: List[int]) -> int:
|
||||
|
||||
# @leet end
|
||||
@@ -1,40 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def evalRPN(self, tokens: List[str]) -> int:
|
||||
|
||||
# @leet end
|
||||
@@ -1,42 +0,0 @@
|
||||
# @leet imports start
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
# @leet imports end
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def maximumInvitations(self, grid: List[List[int]]) -> int:
|
||||
|
||||
# @leet end
|
||||
@@ -1,83 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def kthSmallestProduct(self, nums1: List[int], nums2: List[int], k: int) -> int:
|
||||
low = -(10**10)
|
||||
high = 10**10
|
||||
|
||||
def countLessEqual(p):
|
||||
count = 0
|
||||
for i in range(len(nums1)):
|
||||
l, h = 0, len(nums2)
|
||||
if nums1[i] == 0 and p >= 0:
|
||||
count += len(nums2)
|
||||
elif nums1[i] > 0:
|
||||
while l < h:
|
||||
mid = (l + h) // 2
|
||||
x = nums1[i] * nums2[mid]
|
||||
if x <= p:
|
||||
l = mid + 1
|
||||
else:
|
||||
h = mid
|
||||
count += l
|
||||
else:
|
||||
while l < h:
|
||||
mid = (l + h) // 2
|
||||
x = nums1[i] * nums2[mid]
|
||||
if x <= p:
|
||||
h = mid
|
||||
else:
|
||||
l = mid + 1
|
||||
count += len(nums2) - l
|
||||
|
||||
|
||||
|
||||
return count
|
||||
|
||||
while low < high:
|
||||
mid = (low + high) // 2
|
||||
count = countLessEqual(mid)
|
||||
if count < k:
|
||||
low = mid + 1
|
||||
else:
|
||||
high = mid
|
||||
|
||||
return low
|
||||
|
||||
|
||||
# @leet end
|
||||
@@ -1,45 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
# Definition for singly-linked list.
|
||||
# class ListNode:
|
||||
# def __init__(self, val=0, next=None):
|
||||
# self.val = val
|
||||
# self.next = next
|
||||
class Solution:
|
||||
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
|
||||
|
||||
# @leet end
|
||||
@@ -1,66 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def canBeValid(self, s: str, locked: str) -> bool:
|
||||
var = ''
|
||||
new_str = []
|
||||
for i in s:
|
||||
new_str.append(i)
|
||||
|
||||
for i in range(len(s)):
|
||||
if i % 2 == 0:
|
||||
var = '('
|
||||
if var != s[i] and locked[i] == "0":
|
||||
new_str[i] = var
|
||||
elif i % 2 != 0:
|
||||
var = ')'
|
||||
if var != s[i] and locked[i] == "0":
|
||||
new_str[i] = var
|
||||
|
||||
count_v = 0
|
||||
count_x = 0
|
||||
for i in new_str:
|
||||
if i == ')':
|
||||
count_x += 1
|
||||
if i == '(':
|
||||
count_v += 1
|
||||
|
||||
return count_v % 2 == 0 and count_x % 2 == 0
|
||||
|
||||
|
||||
|
||||
# @leet end
|
||||
@@ -1,41 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def minimizeMax(self, nums: List[int], p: int) -> int:
|
||||
nums.sort()
|
||||
|
||||
# @leet end
|
||||
@@ -1,40 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def divideArray(self, nums: List[int], k: int) -> List[List[int]]:
|
||||
|
||||
# @leet end
|
||||
@@ -1,5 +0,0 @@
|
||||
// @leet start
|
||||
function lengthOfLongestSubstring(s: string): number {
|
||||
|
||||
};
|
||||
// @leet end
|
||||
@@ -1,40 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def maxDifference(self, s: str, k: int) -> int:
|
||||
|
||||
# @leet end
|
||||
@@ -1,42 +0,0 @@
|
||||
# @leet imports start
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
# @leet imports end
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def jump(self, nums: List[int]) -> int:
|
||||
|
||||
# @leet end
|
||||
5
src/exercises/595.big-countries.sql
Normal file
5
src/exercises/595.big-countries.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
# Write your MySQL query statement below
|
||||
select w.name, w.population, w.area
|
||||
from world as w
|
||||
where w.area >= 3000000
|
||||
or w.population >= 25000000
|
||||
@@ -1,45 +0,0 @@
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
|
||||
# @leet start
|
||||
# Definition for singly-linked list.
|
||||
# class ListNode:
|
||||
# def __init__(self, val=0, next=None):
|
||||
# self.val = val
|
||||
# self.next = next
|
||||
class Solution:
|
||||
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
|
||||
|
||||
# @leet end
|
||||
@@ -1,42 +0,0 @@
|
||||
# @leet imports start
|
||||
from string import *
|
||||
from re import *
|
||||
from datetime import *
|
||||
from collections import *
|
||||
from heapq import *
|
||||
from bisect import *
|
||||
from copy import *
|
||||
from math import *
|
||||
from random import *
|
||||
from statistics import *
|
||||
from itertools import *
|
||||
from functools import *
|
||||
from operator import *
|
||||
from io import *
|
||||
from sys import *
|
||||
from json import *
|
||||
from builtins import *
|
||||
import string
|
||||
import re
|
||||
import datetime
|
||||
import collections
|
||||
import heapq
|
||||
import bisect
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import itertools
|
||||
import functools
|
||||
import operator
|
||||
import io
|
||||
import sys
|
||||
import json
|
||||
from typing import *
|
||||
# @leet imports end
|
||||
|
||||
# @leet start
|
||||
class Solution:
|
||||
def equationsPossible(self, equations: List[str]) -> bool:
|
||||
|
||||
# @leet end
|
||||
Reference in New Issue
Block a user