├── .github └── workflows │ ├── leetcode-sync.yml │ └── static.yml ├── .gitmodules ├── 0001-two-sum ├── 0001-two-sum.py └── README.md ├── 0002-add-two-numbers ├── 0002-add-two-numbers.py ├── NOTES.md └── README.md ├── 0003-longest-substring-without-repeating-characters ├── 0003-longest-substring-without-repeating-characters.py ├── NOTES.md └── README.md ├── 0004-median-of-two-sorted-arrays ├── 0004-median-of-two-sorted-arrays.py ├── NOTES.md └── README.md ├── 0005-longest-palindromic-substring ├── 0005-longest-palindromic-substring.py ├── NOTES.md └── README.md ├── 0006-zigzag-conversion ├── 0006-zigzag-conversion.py └── README.md ├── 0010-regular-expression-matching ├── 0010-regular-expression-matching.py ├── NOTES.md └── README.md ├── 0012-integer-to-roman ├── 0012-integer-to-roman.py └── NOTES.md ├── 0013-roman-to-integer ├── 0013-roman-to-integer.py └── README.md ├── 0014-longest-common-prefix ├── 0014-longest-common-prefix.py ├── NOTES.md └── README.md ├── 0015-3sum ├── 0015-3sum.py └── README.md ├── 0017-letter-combinations-of-a-phone-number ├── 0017-letter-combinations-of-a-phone-number.py ├── NOTES.md └── README.md ├── 0018-4sum ├── 0018-4sum.py └── README.md ├── 001_Two_Sum.py ├── 0020-valid-parentheses ├── 0020-valid-parentheses.py ├── NOTES.md └── README.md ├── 0022-generate-parentheses ├── 0022-generate-parentheses.py ├── NOTES.md └── README.md ├── 0023-merge-k-sorted-lists ├── 0023-merge-k-sorted-lists.py └── README.md ├── 0025-reverse-nodes-in-k-group ├── 0025-reverse-nodes-in-k-group.py └── README.md ├── 0027-remove-element ├── 0027-remove-element.py ├── NOTES.md └── README.md ├── 0028-find-the-index-of-the-first-occurrence-in-a-string ├── 0028-find-the-index-of-the-first-occurrence-in-a-string.py ├── NOTES.md └── README.md ├── 002_Add_Two_Numbers.py ├── 0031-next-permutation ├── 0031-next-permutation.py └── README.md ├── 0033-search-in-rotated-sorted-array ├── 0033-search-in-rotated-sorted-array.py └── README.md ├── 0035-search-insert-position ├── 0035-search-insert-position.py ├── NOTES.md └── README.md ├── 0037-sudoku-solver ├── 0037-sudoku-solver.py ├── NOTES.md └── README.md ├── 0039-combination-sum ├── 0039-combination-sum.py └── README.md ├── 003_Longest_Substring_Without_Repeating_Characters.py ├── 0040-combination-sum-ii ├── 0040-combination-sum-ii.py └── README.md ├── 0042-trapping-rain-water ├── 0042-trapping-rain-water.py └── README.md ├── 0043-multiply-strings ├── 0043-multiply-strings.py ├── NOTES.md └── README.md ├── 0044-wildcard-matching ├── 0044-wildcard-matching.py ├── NOTES.md └── README.md ├── 0045-jump-game-ii ├── 0045-jump-game-ii.py └── NOTES.md ├── 0046-permutations └── README.md ├── 004_Median_of_Two_Sorted_Arrays.py ├── 0050-powx-n ├── 0050-powx-n.py ├── NOTES.md └── README.md ├── 0051-n-queens ├── 0051-n-queens.py ├── NOTES.md └── README.md ├── 0052-n-queens-ii ├── 0052-n-queens-ii.py ├── NOTES.md └── README.md ├── 0053-maximum-subarray ├── 0053-maximum-subarray.py ├── NOTES.md └── README.md ├── 0056-merge-intervals ├── 0056-merge-intervals.py ├── NOTES.md └── README.md ├── 0057-insert-interval ├── 0057-insert-interval.py ├── NOTES.md └── README.md ├── 005_Longest_Palindromic_Substring.py ├── 0060-permutation-sequence ├── 0060-permutation-sequence.py └── README.md ├── 0062-unique-paths ├── 0062-unique-paths.py └── README.md ├── 0064-minimum-path-sum ├── 0064-minimum-path-sum.py ├── NOTES.md └── README.md ├── 0067-add-binary ├── 0067-add-binary.py └── README.md ├── 0069-sqrtx ├── 0069-sqrtx.py └── README.md ├── 006_ZigZag_Conversion.py ├── 0070-climbing-stairs ├── 0070-climbing-stairs.py └── README.md ├── 0072-edit-distance ├── 0072-edit-distance.py ├── NOTES.md └── README.md ├── 0075-sort-colors ├── 0075-sort-colors.py └── README.md ├── 0076-minimum-window-substring ├── 0076-minimum-window-substring.py └── README.md ├── 007_Reverse_Integer.py ├── 0084-largest-rectangle-in-histogram ├── 0084-largest-rectangle-in-histogram.py └── README.md ├── 0085-maximal-rectangle ├── 0085-maximal-rectangle.py └── NOTES.md ├── 0086-partition-list ├── 0086-partition-list.py ├── NOTES.md └── README.md ├── 0087-scramble-string ├── 0087-scramble-string.py ├── NOTES.md └── README.md ├── 0088-merge-sorted-array ├── 0088-merge-sorted-array.py └── README.md ├── 008_String_to_Integer(atoi).py ├── 0090-subsets-ii └── README.md ├── 0091-decode-ways ├── 0091-decode-ways.py ├── NOTES.md └── README.md ├── 0093-restore-ip-addresses ├── 0093-restore-ip-addresses.py ├── NOTES.md └── README.md ├── 0094-binary-tree-inorder-traversal ├── 0094-binary-tree-inorder-traversal.py ├── NOTES.md └── README.md ├── 0096-unique-binary-search-trees ├── 0096-unique-binary-search-trees.py └── README.md ├── 0098-validate-binary-search-tree ├── 0098-validate-binary-search-tree.py └── README.md ├── 009_Palindrome_Number.py ├── 0100-same-tree ├── 0100-same-tree.py └── README.md ├── 0101-symmetric-tree ├── 0101-symmetric-tree.py ├── NOTES.md └── README.md ├── 0102-binary-tree-level-order-traversal ├── 0102-binary-tree-level-order-traversal.py ├── NOTES.md └── README.md ├── 0103-binary-tree-zigzag-level-order-traversal ├── 0103-binary-tree-zigzag-level-order-traversal.py ├── NOTES.md └── README.md ├── 0105-construct-binary-tree-from-preorder-and-inorder-traversal ├── 0105-construct-binary-tree-from-preorder-and-inorder-traversal.py ├── NOTES.md └── README.md ├── 0106-construct-binary-tree-from-inorder-and-postorder-traversal ├── 0106-construct-binary-tree-from-inorder-and-postorder-traversal.py ├── NOTES.md └── README.md ├── 0109-convert-sorted-list-to-binary-search-tree ├── 0109-convert-sorted-list-to-binary-search-tree.py ├── NOTES.md └── README.md ├── 010_Regular_Expression_Matching.py ├── 0110-balanced-binary-tree ├── 0110-balanced-binary-tree.py ├── NOTES.md └── README.md ├── 0114-flatten-binary-tree-to-linked-list ├── 0114-flatten-binary-tree-to-linked-list.py ├── NOTES.md └── README.md ├── 0115-distinct-subsequences ├── 0115-distinct-subsequences.py ├── NOTES.md └── README.md ├── 0117-populating-next-right-pointers-in-each-node-ii ├── 0117-populating-next-right-pointers-in-each-node-ii.py ├── NOTES.md └── README.md ├── 0118-pascals-triangle ├── 0118-pascals-triangle.py └── README.md ├── 011_Container_With_Most_Water.py ├── 0121-best-time-to-buy-and-sell-stock ├── 0121-best-time-to-buy-and-sell-stock.py └── README.md ├── 0122-best-time-to-buy-and-sell-stock-ii ├── 0122-best-time-to-buy-and-sell-stock-ii.py ├── NOTES.md └── README.md ├── 0123-best-time-to-buy-and-sell-stock-iii ├── 0123-best-time-to-buy-and-sell-stock-iii.py └── README.md ├── 0124-binary-tree-maximum-path-sum ├── 0124-binary-tree-maximum-path-sum.py ├── NOTES.md └── README.md ├── 0127-word-ladder ├── 0127-word-ladder.py └── README.md ├── 0129-sum-root-to-leaf-numbers ├── 0129-sum-root-to-leaf-numbers.py ├── NOTES.md └── README.md ├── 012_Integer_to_Roman.py ├── 0130-surrounded-regions └── README.md ├── 0133-clone-graph ├── 0133-clone-graph.py └── README.md ├── 0134-gas-station ├── 0134-gas-station.py └── README.md ├── 0135-candy ├── 0135-candy.py ├── NOTES.md └── README.md ├── 0136-single-number ├── 0136-single-number.py └── README.md ├── 0137-single-number-ii ├── 0137-single-number-ii.py ├── NOTES.md └── README.md ├── 0138-copy-list-with-random-pointer ├── 0138-copy-list-with-random-pointer.py └── README.md ├── 0139-word-break ├── 0139-word-break.py ├── NOTES.md └── README.md ├── 013_Roman_to_Integer.py ├── 0140-word-break-ii ├── 0140-word-break-ii.py ├── NOTES.md └── README.md ├── 0141-linked-list-cycle ├── 0141-linked-list-cycle.py └── README.md ├── 0142-linked-list-cycle-ii ├── 0142-linked-list-cycle-ii.py └── NOTES.md ├── 0144-binary-tree-preorder-traversal ├── 0144-binary-tree-preorder-traversal.py ├── NOTES.md └── README.md ├── 0145-binary-tree-postorder-traversal ├── 0145-binary-tree-postorder-traversal.py ├── NOTES.md └── README.md ├── 0146-lru-cache ├── 0146-lru-cache.py ├── NOTES.md └── README.md ├── 0147-insertion-sort-list ├── 0147-insertion-sort-list.py ├── NOTES.md └── README.md ├── 0149-max-points-on-a-line ├── 0149-max-points-on-a-line.py ├── NOTES.md └── README.md ├── 014_Longest_Common_Prefix.py ├── 0151-reverse-words-in-a-string ├── 0151-reverse-words-in-a-string.py ├── NOTES.md └── README.md ├── 0154-find-minimum-in-rotated-sorted-array-ii ├── 0154-find-minimum-in-rotated-sorted-array-ii.py └── README.md ├── 0155-min-stack ├── 0155-min-stack.py └── README.md ├── 015_3Sum.py ├── 0160-intersection-of-two-linked-lists ├── 0160-intersection-of-two-linked-lists.py └── README.md ├── 0165-compare-version-numbers ├── 0165-compare-version-numbers.py └── README.md ├── 0166-fraction-to-recurring-decimal ├── 0166-fraction-to-recurring-decimal.py └── NOTES.md ├── 0169-majority-element ├── 0169-majority-element.py ├── NOTES.md └── README.md ├── 016_3Sum_Closest.py ├── 0171-excel-sheet-column-number ├── 0171-excel-sheet-column-number.py ├── NOTES.md └── README.md ├── 0174-dungeon-game ├── 0174-dungeon-game.py └── README.md ├── 0175-combine-two-tables ├── 0175-combine-two-tables.sql └── README.md ├── 0176-second-highest-salary ├── 0176-second-highest-salary.sql ├── NOTES.md └── README.md ├── 017_Letter_Combinations_of_a_Phone_Number.py ├── 0182-duplicate-emails ├── 0182-duplicate-emails.sql ├── NOTES.md └── README.md ├── 0183-customers-who-never-order ├── 0183-customers-who-never-order.sql └── README.md ├── 0188-best-time-to-buy-and-sell-stock-iv ├── 0188-best-time-to-buy-and-sell-stock-iv.py └── README.md ├── 0189-rotate-array ├── 0189-rotate-array.py └── README.md ├── 018_4Sum.py ├── 0190-reverse-bits ├── 0190-reverse-bits.py └── README.md ├── 0191-number-of-1-bits ├── 0191-number-of-1-bits.py └── NOTES.md ├── 0196-delete-duplicate-emails ├── 0196-delete-duplicate-emails.sql └── NOTES.md ├── 0197-rising-temperature ├── 0197-rising-temperature.sql ├── NOTES.md └── README.md ├── 0198-house-robber ├── 0198-house-robber.py ├── NOTES.md └── README.md ├── 0199-binary-tree-right-side-view ├── 0199-binary-tree-right-side-view.py ├── NOTES.md └── README.md ├── 019_Remove_Nth_Node_From_End_of_List.py ├── 0200-number-of-islands ├── 0200-number-of-islands.py ├── NOTES.md └── README.md ├── 0201-bitwise-and-of-numbers-range ├── 0201-bitwise-and-of-numbers-range.py ├── NOTES.md └── README.md ├── 0206-reverse-linked-list ├── 0206-reverse-linked-list.py └── README.md ├── 0208-implement-trie-prefix-tree ├── 0208-implement-trie-prefix-tree.py ├── NOTES.md └── README.md ├── 0209-minimum-size-subarray-sum ├── 0209-minimum-size-subarray-sum.py └── README.md ├── 020_Valid_Parentheses.py ├── 0211-design-add-and-search-words-data-structure ├── 0211-design-add-and-search-words-data-structure.py ├── NOTES.md └── README.md ├── 0212-word-search-ii ├── 0212-word-search-ii.py └── NOTES.md ├── 0213-house-robber-ii ├── 0213-house-robber-ii.py └── README.md ├── 0218-the-skyline-problem ├── 0218-the-skyline-problem.py └── README.md ├── 021_Merge_Two_Sorted_Lists.py ├── 0222-count-complete-tree-nodes ├── 0222-count-complete-tree-nodes.py └── NOTES.md ├── 0223-rectangle-area ├── 0223-rectangle-area.py ├── NOTES.md └── README.md ├── 0224-basic-calculator ├── 0224-basic-calculator.py ├── NOTES.md └── README.md ├── 0227-basic-calculator-ii ├── 0227-basic-calculator-ii.py ├── NOTES.md └── README.md ├── 0229-majority-element-ii ├── 0229-majority-element-ii.py ├── NOTES.md └── README.md ├── 022_Generate_Parentheses.py ├── 0234-palindrome-linked-list ├── 0234-palindrome-linked-list.py ├── NOTES.md └── README.md ├── 0236-lowest-common-ancestor-of-a-binary-tree ├── 0236-lowest-common-ancestor-of-a-binary-tree.py └── NOTES.md ├── 0237-delete-node-in-a-linked-list ├── 0237-delete-node-in-a-linked-list.py └── README.md ├── 0238-product-of-array-except-self ├── 0238-product-of-array-except-self.py ├── NOTES.md └── README.md ├── 0239-sliding-window-maximum ├── 0239-sliding-window-maximum.py ├── NOTES.md └── README.md ├── 023_Merge_k_Sorted_Lists.py ├── 0241-different-ways-to-add-parentheses ├── 0241-different-ways-to-add-parentheses.py └── README.md ├── 024_Swap_Nodes_in_Pairs.py ├── 025_Reverse_Nodes_i_ k-Group.py ├── 0263-ugly-number ├── 0263-ugly-number.py ├── NOTES.md └── README.md ├── 0264-ugly-number-ii ├── 0264-ugly-number-ii.py ├── NOTES.md └── README.md ├── 026_Remove_Duplicates_from_Sorted_Array.py ├── 0274-h-index ├── 0274-h-index.py └── NOTES.md ├── 0275-h-index-ii ├── 0275-h-index-ii.py ├── NOTES.md └── readme.md ├── 0278-first-bad-version ├── 0278-first-bad-version.py └── README.md ├── 0279-perfect-squares ├── 0279-perfect-squares.py ├── NOTES.md └── README.md ├── 027_Remove_Element.py ├── 028_Implement_strStr().py ├── 0290-word-pattern ├── 0290-word-pattern.py ├── NOTES.md └── README.md ├── 0295-find-median-from-data-stream ├── 0295-find-median-from-data-stream.py └── README.md ├── 029_Divide_Two_Integers.py ├── 0300-longest-increasing-subsequence ├── 0300-longest-increasing-subsequence.py ├── NOTES.md └── README.md ├── 0306-additive-number ├── 0306-additive-number.py ├── NOTES.md └── README.md ├── 0309-best-time-to-buy-and-sell-stock-with-cooldown ├── 0309-best-time-to-buy-and-sell-stock-with-cooldown.py └── README.md ├── 030_Substring_with_Concatenation_of_All_Words.py ├── 0312-burst-balloons ├── 0312-burst-balloons.py ├── NOTES.md └── README.md ├── 0313-super-ugly-number ├── 0313-super-ugly-number.py ├── NOTES.md └── README.md ├── 0318-maximum-product-of-word-lengths ├── 0318-maximum-product-of-word-lengths.py ├── NOTES.md └── README.md ├── 031_Next_Permutation.py ├── 0322-coin-change ├── 0322-coin-change.py ├── NOTES.md └── README.md ├── 0324-wiggle-sort-ii ├── 0324-wiggle-sort-ii.py ├── NOTES.md └── README.md ├── 0329-longest-increasing-path-in-a-matrix ├── 0329-longest-increasing-path-in-a-matrix.py ├── NOTES.md └── README.md ├── 032_Longest_Valid_Parentheses.py ├── 0331-verify-preorder-serialization-of-a-binary-tree ├── 0331-verify-preorder-serialization-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 0332-reconstruct-itinerary ├── 0332-reconstruct-itinerary.py ├── NOTES.md └── README.md ├── 0337-house-robber-iii ├── 0337-house-robber-iii.py ├── NOTES.md └── README.md ├── 033_Search_in_Rotated_Sorted_Array.py ├── 0343-integer-break └── README.md ├── 0347-top-k-frequent-elements ├── 0347-top-k-frequent-elements.py ├── NOTES.md └── README.md ├── 034_Search_for_a_Range.py ├── 0354-russian-doll-envelopes ├── 0354-russian-doll-envelopes.py ├── NOTES.md └── README.md ├── 0355-design-twitter ├── 0355-design-twitter.py ├── NOTES.md └── README.md ├── 0357-count-numbers-with-unique-digits ├── 0357-count-numbers-with-unique-digits.py ├── NOTES.md └── README.md ├── 035_Search_Insert_Position.py ├── 0363-max-sum-of-rectangle-no-larger-than-k ├── 0363-max-sum-of-rectangle-no-larger-than-k.py ├── NOTES.md └── README.md ├── 0367-valid-perfect-square ├── 0367-valid-perfect-square.py ├── NOTES.md └── README.md ├── 0368-largest-divisible-subset ├── 0368-largest-divisible-subset.py ├── NOTES.md └── README.md ├── 036_Valid Sudoku.py ├── 0373-find-k-pairs-with-smallest-sums ├── 0373-find-k-pairs-with-smallest-sums.py ├── NOTES.md └── README.md ├── 0374-guess-number-higher-or-lower ├── 0374-guess-number-higher-or-lower.py └── NOTES.md ├── 0375-guess-number-higher-or-lower-ii ├── 0375-guess-number-higher-or-lower-ii.py ├── NOTES.md └── README.md ├── 0376-wiggle-subsequence ├── 0376-wiggle-subsequence.py ├── NOTES.md └── README.md ├── 0377-combination-sum-iv ├── 0377-combination-sum-iv.py ├── NOTES.md └── README.md ├── 0378-kth-smallest-element-in-a-sorted-matrix ├── 0378-kth-smallest-element-in-a-sorted-matrix.py ├── NOTES.md └── README.md ├── 037_Sudoku_Solver.py ├── 0380-insert-delete-getrandom-o1 ├── 0380-insert-delete-getrandom-o1.py ├── NOTES.md └── README.md ├── 0382-linked-list-random-node ├── 0382-linked-list-random-node.py ├── NOTES.md └── README.md ├── 0384-shuffle-an-array ├── 0384-shuffle-an-array.py ├── NOTES.md └── README.md ├── 0386-lexicographical-numbers ├── 0386-lexicographical-numbers.py └── README.md ├── 038_Count_and_Say.py ├── 0391-perfect-rectangle ├── 0391-perfect-rectangle.py ├── NOTES.md └── README.md ├── 0392-is-subsequence ├── 0392-is-subsequence.py └── NOTES.md ├── 0399-evaluate-division ├── 0399-evaluate-division.py ├── NOTES.md └── README.md ├── 039_Combination_Sum.py ├── 0406-queue-reconstruction-by-height ├── 0406-queue-reconstruction-by-height.py ├── NOTES.md └── README.md ├── 0407-trapping-rain-water-ii ├── 0407-trapping-rain-water-ii.py ├── NOTES.md └── README.md ├── 040_Combination_Sum_II.py ├── 0413-arithmetic-slices ├── 0413-arithmetic-slices.py └── NOTES.md ├── 0415-add-strings ├── 0415-add-strings.py ├── NOTES.md └── README.md ├── 0416-partition-equal-subset-sum ├── 0416-partition-equal-subset-sum.py ├── NOTES.md └── README.md ├── 0417-pacific-atlantic-water-flow ├── 0417-pacific-atlantic-water-flow.py └── README.md ├── 041_First_Missing_Positive.py ├── 0424-longest-repeating-character-replacement ├── 0424-longest-repeating-character-replacement.py ├── NOTES.md └── README.md ├── 0429-n-ary-tree-level-order-traversal ├── 0429-n-ary-tree-level-order-traversal.py └── README.md ├── 042_Trapping_Rain_Water.py ├── 0430-flatten-a-multilevel-doubly-linked-list ├── 0430-flatten-a-multilevel-doubly-linked-list.py └── README.md ├── 0435-non-overlapping-intervals ├── 0435-non-overlapping-intervals.py └── README.md ├── 0436-find-right-interval ├── 0436-find-right-interval.py ├── NOTES.md └── README.md ├── 043_Multiply_Strings.py ├── 0441-arranging-coins ├── 0441-arranging-coins.py ├── NOTES.md └── README.md ├── 0443-string-compression ├── 0443-string-compression.py ├── NOTES.md └── README.md ├── 0445-add-two-numbers-ii ├── 0445-add-two-numbers-ii.py └── README.md ├── 0447-number-of-boomerangs ├── 0447-number-of-boomerangs.py ├── NOTES.md └── README.md ├── 044_Wildcard_Matching.py ├── 0451-sort-characters-by-frequency ├── 0451-sort-characters-by-frequency.py └── README.md ├── 0452-minimum-number-of-arrows-to-burst-balloons ├── 0452-minimum-number-of-arrows-to-burst-balloons.py └── NOTES.md ├── 0456-132-pattern ├── 0456-132-pattern.py ├── NOTES.md └── README.md ├── 045_Jump_Game_II.py ├── 0461-hamming-distance ├── 0461-hamming-distance.py └── NOTES.md ├── 0462-minimum-moves-to-equal-array-elements-ii ├── 0462-minimum-moves-to-equal-array-elements-ii.py └── README.md ├── 0467-unique-substrings-in-wraparound-string ├── 0467-unique-substrings-in-wraparound-string.py ├── NOTES.md └── README.md ├── 046_Permutations.py ├── 0473-matchsticks-to-square ├── 0473-matchsticks-to-square.py ├── NOTES.md └── README.md ├── 0474-ones-and-zeroes ├── 0474-ones-and-zeroes.py ├── NOTES.md └── README.md ├── 0475-heaters ├── 0475-heaters.py ├── NOTES.md └── README.md ├── 0477-total-hamming-distance ├── 0477-total-hamming-distance.py └── README.md ├── 047_Permutations_II.py ├── 0482-license-key-formatting ├── 0482-license-key-formatting.py └── README.md ├── 0485-max-consecutive-ones ├── 0485-max-consecutive-ones.py └── README.md ├── 048_Rotate_Image.py ├── 0493-reverse-pairs ├── 0493-reverse-pairs.py ├── NOTES.md └── README.md ├── 0494-target-sum ├── 0494-target-sum.py ├── NOTES.md └── README.md ├── 0496-next-greater-element-i ├── 0496-next-greater-element-i.py └── README.md ├── 049_Group_Anagrams.py ├── 0506-relative-ranks ├── 0506-relative-ranks.py └── NOTES.md ├── 050_Pow(x, n).py ├── 0511-game-play-analysis-i ├── 0511-game-play-analysis-i.sql ├── NOTES.md └── README.md ├── 0513-find-bottom-left-tree-value ├── 0513-find-bottom-left-tree-value.py └── NOTES.md ├── 0516-longest-palindromic-subsequence ├── 0516-longest-palindromic-subsequence.py └── README.md ├── 0518-coin-change-ii ├── 0518-coin-change-ii.py └── README.md ├── 051_N-Queens.py ├── 0523-continuous-subarray-sum ├── 0523-continuous-subarray-sum.py ├── NOTES.md └── README.md ├── 0524-longest-word-in-dictionary-through-deleting ├── 0524-longest-word-in-dictionary-through-deleting.py └── README.md ├── 0526-beautiful-arrangement ├── 0526-beautiful-arrangement.py ├── NOTES.md └── README.md ├── 052_N-Queens II.py ├── 0530-minimum-absolute-difference-in-bst ├── 0530-minimum-absolute-difference-in-bst.py ├── NOTES.md └── README.md ├── 0535-encode-and-decode-tinyurl ├── 0535-encode-and-decode-tinyurl.py ├── NOTES.md └── README.md ├── 053_Maximum_Subarray.py ├── 0540-single-element-in-a-sorted-array ├── 0540-single-element-in-a-sorted-array.py └── README.md ├── 0541-reverse-string-ii ├── 0541-reverse-string-ii.py ├── NOTES.md └── README.md ├── 0543-diameter-of-binary-tree ├── 0543-diameter-of-binary-tree.py └── README.md ├── 054_Spiral_Matrix.py ├── 0554-brick-wall ├── 0554-brick-wall.py ├── NOTES.md └── README.md ├── 055_Jump_Game.py ├── 0560-subarray-sum-equals-k ├── 0560-subarray-sum-equals-k.py └── README.md ├── 0565-array-nesting ├── 0565-array-nesting.py └── NOTES.md ├── 0567-permutation-in-string ├── 0567-permutation-in-string.py ├── NOTES.md └── README.md ├── 056_Merge_Intervals.py ├── 057_Insert_Interval.py ├── 0583-delete-operation-for-two-strings ├── 0583-delete-operation-for-two-strings.py └── README.md ├── 0584-find-customer-referee ├── 0584-find-customer-referee.sql └── README.md ├── 0586-customer-placing-the-largest-number-of-orders ├── 0586-customer-placing-the-largest-number-of-orders.sql ├── NOTES.md └── README.md ├── 058_Length_of_Last_Word.py ├── 0595-big-countries ├── 0595-big-countries.sql └── NOTES.md ├── 059_Spiral_Matrix_II.py ├── 0605-can-place-flowers ├── 0605-can-place-flowers.py └── NOTES.md ├── 0606-construct-string-from-binary-tree ├── 0606-construct-string-from-binary-tree.py └── NOTES.md ├── 0607-sales-person ├── 0607-sales-person.sql ├── NOTES.md └── README.md ├── 0608-tree-node ├── 0608-tree-node.sql ├── NOTES.md └── README.md ├── 060_Permutation_Sequence.py ├── 061_Rotate_List.py ├── 0621-task-scheduler ├── 0621-task-scheduler.py └── README.md ├── 0622-design-circular-queue ├── 0622-design-circular-queue.py ├── NOTES.md └── README.md ├── 0627-swap-salary ├── 0627-swap-salary.sql ├── NOTES.md └── README.md ├── 062_Unique_Paths.py ├── 063_Unique_Paths_II.py ├── 0646-maximum-length-of-pair-chain ├── 0646-maximum-length-of-pair-chain.py ├── NOTES.md └── README.md ├── 0647-palindromic-substrings ├── 0647-palindromic-substrings.py ├── NOTES.md └── README.md ├── 064_Minimum_Path_Sum.py ├── 0658-find-k-closest-elements ├── 0658-find-k-closest-elements.py └── NOTES.md ├── 065_Valid_Number.py ├── 0662-maximum-width-of-binary-tree ├── 0662-maximum-width-of-binary-tree.py └── README.md ├── 0667-beautiful-arrangement-ii ├── 0667-beautiful-arrangement-ii.py ├── NOTES.md └── README.md ├── 0669-trim-a-binary-search-tree ├── 0669-trim-a-binary-search-tree.py ├── NOTES.md └── README.md ├── 066_Plus_One.py ├── 0673-number-of-longest-increasing-subsequence ├── 0673-number-of-longest-increasing-subsequence.py ├── NOTES.md └── README.md ├── 0677-map-sum-pairs ├── 0677-map-sum-pairs.py └── README.md ├── 0678-valid-parenthesis-string ├── 0678-valid-parenthesis-string.py ├── NOTES.md └── README.md ├── 067_Add_Binary.py ├── 0682-baseball-game ├── 0682-baseball-game.py └── NOTES.md ├── 0684-redundant-connection ├── 0684-redundant-connection.py └── README.md ├── 0686-repeated-string-match ├── 0686-repeated-string-match.py ├── NOTES.md └── README.md ├── 0687-longest-univalue-path ├── 0687-longest-univalue-path.py ├── NOTES.md └── README.md ├── 0688-knight-probability-in-chessboard ├── 0688-knight-probability-in-chessboard.py ├── NOTES.md └── README.md ├── 0689-maximum-sum-of-3-non-overlapping-subarrays ├── 0689-maximum-sum-of-3-non-overlapping-subarrays.py ├── NOTES.md └── README.md ├── 068_Text_Justification.py ├── 0691-stickers-to-spell-word ├── 0691-stickers-to-spell-word.py ├── NOTES.md └── README.md ├── 0696-count-binary-substrings ├── 0696-count-binary-substrings.py └── README.md ├── 0698-partition-to-k-equal-sum-subsets ├── 0698-partition-to-k-equal-sum-subsets.py ├── NOTES.md └── README.md ├── 069_Sqrt(x).py ├── 0704-binary-search ├── 0704-binary-search.py ├── NOTES.md └── README.md ├── 070_Climbing_Stairs.py ├── 0713-subarray-product-less-than-k ├── 0713-subarray-product-less-than-k.py ├── NOTES.md └── README.md ├── 0714-best-time-to-buy-and-sell-stock-with-transaction-fee ├── 0714-best-time-to-buy-and-sell-stock-with-transaction-fee.py ├── NOTES.md └── README.md ├── 071_Simplify_Path.py ├── 0720-longest-word-in-dictionary ├── 0720-longest-word-in-dictionary.py └── README.md ├── 0729-my-calendar-i ├── 0729-my-calendar-i.py ├── NOTES.md └── README.md ├── 072_Edit_Distance.py ├── 0731-my-calendar-ii ├── 0731-my-calendar-ii.py ├── NOTES.md └── README.md ├── 073_Set_Matrix_Zeroes.py ├── 0740-delete-and-earn ├── 0740-delete-and-earn.py └── NOTES.md ├── 0743-network-delay-time ├── 0743-network-delay-time.py ├── NOTES.md └── README.md ├── 0746-min-cost-climbing-stairs ├── 0746-min-cost-climbing-stairs.py └── README.md ├── 074_Search_a_2D_Matrix.py ├── 0752-open-the-lock ├── 0752-open-the-lock.py ├── NOTES.md └── README.md ├── 0753-open-the-lock ├── 0753-open-the-lock.py └── README.md ├── 075_Sort_Colors.py ├── 0767-reorganize-string ├── 0767-reorganize-string.py └── README.md ├── 0768-partition-labels ├── 0768-partition-labels.py └── README.md ├── 076_Minimum_Window_Substring.py ├── 0778-swim-in-rising-water ├── 0778-swim-in-rising-water.py └── NOTES.md ├── 077_Combinations.py ├── 0781-rabbits-in-forest ├── 0781-rabbits-in-forest.py └── README.md ├── 0783-search-in-a-binary-search-tree ├── 0783-search-in-a-binary-search-tree.py └── README.md ├── 0787-cheapest-flights-within-k-stops ├── 0787-cheapest-flights-within-k-stops.py ├── NOTES.md └── README.md ├── 078_Subsets.py ├── 0790-domino-and-tromino-tiling ├── 0790-domino-and-tromino-tiling.py ├── NOTES.md └── README.md ├── 0797-all-paths-from-source-to-target ├── 0797-all-paths-from-source-to-target.py ├── NOTES.md └── README.md ├── 079_Word_Search.py ├── 0801-minimum-swaps-to-make-sequences-increasing ├── 0801-minimum-swaps-to-make-sequences-increasing.py └── README.md ├── 0802-find-eventual-safe-states ├── 0802-find-eventual-safe-states.py ├── NOTES.md └── README.md ├── 080_Remove_Duplicates_from_Sorted_Array_II.py ├── 0812-largest-triangle-area ├── 0812-largest-triangle-area.py ├── NOTES.md └── README.md ├── 0813-largest-sum-of-averages ├── 0813-largest-sum-of-averages.py ├── NOTES.md └── README.md ├── 081_Search_in_Rotated_Sorted_Array_II.py ├── 0820-find-eventual-safe-states └── README.md ├── 0823-binary-trees-with-factors ├── 0823-binary-trees-with-factors.py ├── NOTES.md └── README.md ├── 083_Remove_Duplicates_from_Sorted_List.py ├── 0844-backspace-string-compare ├── 0844-backspace-string-compare.py └── README.md ├── 0846-hand-of-straights ├── 0846-hand-of-straights.py ├── NOTES.md └── README.md ├── 084_Largest_Rectangle_in_Histogram.py ├── 0853-car-fleet ├── 0853-car-fleet.py ├── NOTES.md └── README.md ├── 085_Maximal_Rectangle.py ├── 0866-rectangle-overlap └── README.md ├── 086_Partition_List.py ├── 0875-koko-eating-bananas ├── 0875-koko-eating-bananas.py ├── NOTES.md └── README.md ├── 0876-middle-of-the-linked-list ├── 0876-middle-of-the-linked-list.py ├── NOTES.md └── README.md ├── 0877-stone-game ├── 0877-stone-game.py └── NOTES.md ├── 087_Scramble_String.py ├── 0881-boats-to-save-people ├── 0881-boats-to-save-people.py ├── NOTES.md └── README.md ├── 0889-construct-binary-tree-from-preorder-and-postorder-traversal ├── 0889-construct-binary-tree-from-preorder-and-postorder-traversal.py ├── NOTES.md └── README.md ├── 088_Merge_Sorted_Array.py ├── 0894-all-possible-full-binary-trees ├── 0894-all-possible-full-binary-trees.py ├── NOTES.md └── README.md ├── 0895-maximum-frequency-stack ├── 0895-maximum-frequency-stack.py ├── NOTES.md └── README.md ├── 089_Gray_Code.py ├── 0908-middle-of-the-linked-list ├── 0908-middle-of-the-linked-list.py └── README.md ├── 090_Subsets_II.py ├── 0912-sort-an-array ├── 0912-sort-an-array.py ├── NOTES.md └── README.md ├── 091_Decode_Ways.py ├── 092_Reverse_Linked_Lis_ II.py ├── 0937-online-stock-span ├── 0937-online-stock-span.py └── README.md ├── 093_Restore_IP_Addresses.py ├── 094_Binary_Tree_Inorder_Traversal.py ├── 0953-verifying-an-alien-dictionary ├── 0953-verifying-an-alien-dictionary.py ├── NOTES.md └── README.md ├── 0958-check-completeness-of-a-binary-tree ├── 0958-check-completeness-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 095_Unique_Binary_Search_Trees_II.py ├── 096_Unique_Binary_Search_Trees.py ├── 0974-subarray-sums-divisible-by-k ├── 0974-subarray-sums-divisible-by-k.py ├── NOTES.md └── README.md ├── 0979-distribute-coins-in-binary-tree ├── 0979-distribute-coins-in-binary-tree.py ├── NOTES.md └── README.md ├── 097_Interleaving_String.py ├── 0981-time-based-key-value-store ├── 0981-time-based-key-value-store.py ├── NOTES.md └── README.md ├── 0983-minimum-cost-for-tickets ├── 0983-minimum-cost-for-tickets.py ├── NOTES.md └── README.md ├── 0987-vertical-order-traversal-of-a-binary-tree ├── 0987-vertical-order-traversal-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 098_Validate_Binary_Search_Tree.py ├── 099_Recover_Binary_Search_Tree.py ├── 1-two-sum ├── 1-two-sum.py ├── NOTES.md └── README.md ├── 10-regular-expression-matching ├── 10-regular-expression-matching.py ├── NOTES.md └── README.md ├── 100-same-tree ├── 100-same-tree.py ├── NOTES.md └── README.md ├── 1004-max-consecutive-ones-iii ├── 1004-max-consecutive-ones-iii.py ├── NOTES.md └── README.md ├── 1005-maximize-sum-of-array-after-k-negations ├── 1005-maximize-sum-of-array-after-k-negations.py ├── NOTES.md └── README.md ├── 1008-construct-binary-search-tree-from-preorder-traversal ├── 1008-construct-binary-search-tree-from-preorder-traversal.py ├── NOTES.md └── README.md ├── 100_Same_Tree.py ├── 101-symmetric-tree ├── 101-symmetric-tree.py ├── NOTES.md └── README.md ├── 1011-capacity-to-ship-packages-within-d-days ├── 1011-capacity-to-ship-packages-within-d-days.py ├── NOTES.md └── README.md ├── 1014-best-sightseeing-pair ├── 1014-best-sightseeing-pair.py ├── NOTES.md └── README.md ├── 101_Symmetric_Tree.py ├── 102-binary-tree-level-order-traversal ├── 102-binary-tree-level-order-traversal.py ├── NOTES.md └── README.md ├── 1027-longest-arithmetic-subsequence ├── 1027-longest-arithmetic-subsequence.py ├── NOTES.md └── README.md ├── 1029-two-city-scheduling ├── 1029-two-city-scheduling.py ├── NOTES.md └── README.md ├── 1029-vertical-order-traversal-of-a-binary-tree ├── 1029-vertical-order-traversal-of-a-binary-tree.py └── README.md ├── 102_Binary_Tree_Level_Order_Traversal.py ├── 103-binary-tree-zigzag-level-order-traversal ├── 103-binary-tree-zigzag-level-order-traversal.py ├── NOTES.md └── README.md ├── 1031-maximum-sum-of-two-non-overlapping-subarrays ├── 1031-maximum-sum-of-two-non-overlapping-subarrays.py └── README.md ├── 1035-uncrossed-lines ├── 1035-uncrossed-lines.py ├── NOTES.md └── README.md ├── 1038-binary-search-tree-to-greater-sum-tree ├── 1038-binary-search-tree-to-greater-sum-tree.py ├── NOTES.md └── README.md ├── 103_Binary_Tree_Zigzag_Level_Order_Traversal.py ├── 104-maximum-depth-of-binary-tree ├── 104-maximum-depth-of-binary-tree.py ├── NOTES.md └── README.md ├── 1041-robot-bounded-in-circle ├── 1041-robot-bounded-in-circle.py └── README.md ├── 1046-last-stone-weight ├── 1046-last-stone-weight.py ├── NOTES.md └── README.md ├── 104_Maximum_Depth_of_Binary_Tree.py ├── 105-construct-binary-tree-from-preorder-and-inorder-traversal ├── 105-construct-binary-tree-from-preorder-and-inorder-traversal.py ├── NOTES.md └── README.md ├── 1050-actors-and-directors-who-cooperated-at-least-three-times ├── 1050-actors-and-directors-who-cooperated-at-least-three-times.sql └── README.md ├── 105_Construct_Binary_Tree_from_Preorder_and_Inorder_Traversal.py ├── 106-construct-binary-tree-from-inorder-and-postorder-traversal ├── 106-construct-binary-tree-from-inorder-and-postorder-traversal.py ├── NOTES.md └── README.md ├── 1064_Fixed_Point.py ├── 106_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal.py ├── 1071-greatest-common-divisor-of-strings ├── 1071-greatest-common-divisor-of-strings.py ├── NOTES.md └── README.md ├── 1079-letter-tile-possibilities ├── 1079-letter-tile-possibilities.py ├── NOTES.md └── README.md ├── 107_Binary_Tree_Level_Order_Traversal_II.py ├── 108-convert-sorted-array-to-binary-search-tree ├── 108-convert-sorted-array-to-binary-search-tree.py ├── NOTES.md └── README.md ├── 1084-sales-analysis-iii ├── 1084-sales-analysis-iii.sql └── README.md ├── 1089_Duplicate_Zeros.py ├── 108_Convert_Sorted_Array_to_Binary_Search_Tree.py ├── 109-convert-sorted-list-to-binary-search-tree ├── 109-convert-sorted-list-to-binary-search-tree.py ├── NOTES.md └── README.md ├── 1092-shortest-common-supersequence ├── 1092-shortest-common-supersequence.py ├── NOTES.md └── README.md ├── 1094-car-pooling ├── 1094-car-pooling.py ├── NOTES.md └── README.md ├── 109_Convert_Sorted_List_to_Binary_Search_Tree.py ├── 11-container-with-most-water ├── 11-container-with-most-water.py ├── NOTES.md └── README.md ├── 110-balanced-binary-tree ├── 110-balanced-binary-tree.py ├── NOTES.md └── README.md ├── 1106-parsing-a-boolean-expression ├── 1106-parsing-a-boolean-expression.py ├── NOTES.md └── README.md ├── 1108_Defanging_an_IP_Address.py ├── 110_Balanced_Binary_Tree.py ├── 1114-print-in-order ├── 1114-print-in-order.py ├── NOTES.md └── README.md ├── 1117-as-far-from-land-as-possible ├── 1117-as-far-from-land-as-possible.py ├── README.md └── as-far-from-land-as-possible.py ├── 1119-robot-bounded-in-circle ├── 1119-robot-bounded-in-circle.py └── README.md ├── 111_Minimum_Depth_of_Binary_Tree.py ├── 112-path-sum ├── 112-path-sum.py └── README.md ├── 112_Path_Sum.py ├── 113-path-sum-ii ├── 113-path-sum-ii.py ├── NOTES.md └── README.md ├── 1130-minimum-cost-tree-from-leaf-values ├── 1130-minimum-cost-tree-from-leaf-values.py ├── NOTES.md └── README.md ├── 113_Path_Sum_II.py ├── 114-flatten-binary-tree-to-linked-list ├── 114-flatten-binary-tree-to-linked-list.py ├── NOTES.md └── README.md ├── 1141-user-activity-for-the-past-30-days-i ├── 1141-user-activity-for-the-past-30-days-i.sql └── README.md ├── 1143-longest-common-subsequence ├── 1143-longest-common-subsequence.py ├── NOTES.md └── README.md ├── 1146-greatest-common-divisor-of-strings ├── 1146-greatest-common-divisor-of-strings.py └── README.md ├── 1148-article-views-i ├── 1148-article-views-i.sql └── NOTES.md ├── 114_Flatten_Binary_Tree_to_Linked_List.py ├── 115-distinct-subsequences ├── 115-distinct-subsequences.py ├── NOTES.md └── README.md ├── 1158-market-analysis-i ├── 1158-market-analysis-i.sql ├── NOTES.md └── README.md ├── 115_Distinct_Subsequences.py ├── 116-populating-next-right-pointers-in-each-node ├── 116-populating-next-right-pointers-in-each-node.py ├── NOTES.md └── README.md ├── 1162-as-far-from-land-as-possible ├── 1162-as-far-from-land-as-possible.py ├── NOTES.md └── README.md ├── 116_Populating_Next_Right_Pointers_in_Each_Node.py ├── 117_Populating_Next_Right_Pointers_in_Each_Node_II.py ├── 118-pascals-triangle ├── 118-pascals-triangle.py ├── NOTES.md └── README.md ├── 1189-maximum-number-of-balloons ├── 1189-maximum-number-of-balloons.py ├── NOTES.md └── README.md ├── 118_Pascal's_Triangle.py ├── 119-pascals-triangle-ii ├── 119-pascals-triangle-ii.py ├── NOTES.md └── README.md ├── 119_Pascal's_Triangle_II.py ├── 12-integer-to-roman ├── 12-integer-to-roman.py ├── NOTES.md └── README.md ├── 120-triangle ├── 120-triangle.py └── NOTES.md ├── 1200-minimum-absolute-difference ├── 1200-minimum-absolute-difference.py ├── NOTES.md └── README.md ├── 1207-unique-number-of-occurrences ├── 1207-unique-number-of-occurrences.py └── NOTES.md ├── 1208-get-equal-substrings-within-budget ├── 1208-get-equal-substrings-within-budget.py ├── NOTES.md └── README.md ├── 1209-remove-all-adjacent-duplicates-in-string-ii ├── 1209-remove-all-adjacent-duplicates-in-string-ii.py ├── NOTES.md └── README.md ├── 120_Triangle.py ├── 121-best-time-to-buy-and-sell-stock ├── 121-best-time-to-buy-and-sell-stock.py ├── NOTES.md └── README.md ├── 121_Best_Time_to_Buy_and_Sell_Stock.py ├── 122-best-time-to-buy-and-sell-stock-ii ├── 122-best-time-to-buy-and-sell-stock-ii.py ├── NOTES.md └── README.md ├── 1220-count-vowels-permutation ├── 1220-count-vowels-permutation.py ├── NOTES.md └── README.md ├── 1221-split-a-string-in-balanced-strings ├── 1221-split-a-string-in-balanced-strings.py ├── NOTES.md └── README.md ├── 122_Best_Time_to_Buy_and_Sell_Stock_II.py ├── 123-best-time-to-buy-and-sell-stock-iii ├── 123-best-time-to-buy-and-sell-stock-iii.py ├── NOTES.md └── README.md ├── 1235-maximum-profit-in-job-scheduling ├── 1235-maximum-profit-in-job-scheduling.py ├── NOTES.md └── README.md ├── 1239-maximum-length-of-a-concatenated-string-with-unique-characters ├── 1239-maximum-length-of-a-concatenated-string-with-unique-characters.py ├── NOTES.md └── README.md ├── 123_Best_Time_to_Buy_and_Sell_Stock_III.py ├── 124-binary-tree-maximum-path-sum ├── 124-binary-tree-maximum-path-sum.py ├── NOTES.md └── README.md ├── 124_Binary_Tree_Maximum_Path_Sum.py ├── 125_Valid_Palindrome.py ├── 126-word-ladder-ii ├── 126-word-ladder-ii.py ├── NOTES.md └── README.md ├── 1260_Shift_2D_Grid.py ├── 1266-minimum-time-visiting-all-points ├── 1266-minimum-time-visiting-all-points.py └── README.md ├── 1268-search-suggestions-system ├── 1268-search-suggestions-system.py └── NOTES.md ├── 126_Word_Ladder_II.py ├── 127-word-ladder ├── 127-word-ladder.py ├── NOTES.md └── README.md ├── 127_Word_Ladder.py ├── 128-longest-consecutive-sequence ├── 128-longest-consecutive-sequence.py ├── NOTES.md └── README.md ├── 1288-remove-covered-intervals ├── 1288-remove-covered-intervals.py ├── NOTES.md └── README.md ├── 128_Longest_Consecutive_Sequence.py ├── 129-sum-root-to-leaf-numbers ├── 129-sum-root-to-leaf-numbers.py ├── NOTES.md └── README.md ├── 1290_Convert_Binary_Number_in_a_Linked_List_to_Integer.py ├── 1296-divide-array-in-sets-of-k-consecutive-numbers ├── 1296-divide-array-in-sets-of-k-consecutive-numbers.py ├── NOTES.md └── README.md ├── 129_Sum_Root_to_Leaf_Numbers.py ├── 13-roman-to-integer ├── 13-roman-to-integer.py ├── NOTES.md └── README.md ├── 130-surrounded-regions ├── 130-surrounded-regions.py └── NOTES.md ├── 1302-deepest-leaves-sum ├── 1302-deepest-leaves-sum.py ├── NOTES.md └── README.md ├── 1304_Find_N_Unique_Integers_Sum_up_to_Zero.py ├── 1306-jump-game-iii ├── 1306-jump-game-iii.py ├── NOTES.md └── README.md ├── 1309-decrypt-string-from-alphabet-to-integer-mapping ├── 1309-decrypt-string-from-alphabet-to-integer-mapping.py ├── NOTES.md └── README.md ├── 130_Surrounded_Regions.py ├── 131-palindrome-partitioning ├── 131-palindrome-partitioning.py ├── NOTES.md └── README.md ├── 1310_XOR_Queries_of_a_Subarray.py ├── 1312-minimum-insertion-steps-to-make-a-string-palindrome ├── 1312-minimum-insertion-steps-to-make-a-string-palindrome.py ├── NOTES.md └── README.md ├── 1318-minimum-flips-to-make-a-or-b-equal-to-c ├── 1318-minimum-flips-to-make-a-or-b-equal-to-c.py ├── NOTES.md └── README.md ├── 1319-number-of-operations-to-make-network-connected ├── 1319-number-of-operations-to-make-network-connected.py ├── NOTES.md └── README.md ├── 131_Palindrome_Partitioning.py ├── 1321-get-equal-substrings-within-budget ├── 1321-get-equal-substrings-within-budget.py └── README.md ├── 1323_Maximum_69_Number.py ├── 1328-break-a-palindrome ├── 1328-break-a-palindrome.py └── README.md ├── 132_Palindrome_Partitioning_II.py ├── 133-clone-graph ├── 133-clone-graph.py ├── NOTES.md └── README.md ├── 1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance ├── 1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.py ├── NOTES.md └── README.md ├── 1337_The_K_Weakest_Rows_in_a_Matrix.py ├── 133_Clone_Graph.py ├── 134-gas-station ├── 134-gas-station.py ├── NOTES.md └── README.md ├── 1342-number-of-steps-to-reduce-a-number-to-zero ├── 1342-number-of-steps-to-reduce-a-number-to-zero.py └── NOTES.md ├── 1342_Number_of_Steps_to_Reduce_a_Number_to_Zero.py ├── 1345-jump-game-iv ├── 1345-jump-game-iv.py ├── NOTES.md └── README.md ├── 1347-minimum-number-of-steps-to-make-two-strings-anagram ├── 1347-minimum-number-of-steps-to-make-two-strings-anagram.py ├── NOTES.md └── README.md ├── 134_Gas_Station.py ├── 135-candy ├── 135-candy.py ├── NOTES.md └── README.md ├── 135_Candy.py ├── 136-single-number ├── 136-single-number.py ├── NOTES.md └── README.md ├── 1365_How_Many_Numbers_Are_Smaller_Than_the_Current_Number.py ├── 1367-linked-list-in-binary-tree ├── 1367-linked-list-in-binary-tree.py ├── NOTES.md └── README.md ├── 136_Single_Number.py ├── 137-single-number-ii ├── 137-single-number-ii.py └── README.md ├── 1373-maximum-sum-bst-in-binary-tree ├── 1373-maximum-sum-bst-in-binary-tree.py ├── NOTES.md └── README.md ├── 137_Single_Number_II.py ├── 138-copy-list-with-random-pointer ├── 138-copy-list-with-random-pointer.py ├── NOTES.md └── README.md ├── 1382-balance-a-binary-search-tree ├── 1382-balance-a-binary-search-tree.py ├── NOTES.md └── README.md ├── 1383-maximum-performance-of-a-team ├── 1383-maximum-performance-of-a-team.py ├── NOTES.md └── README.md ├── 138_Copy_List_with_Random_Pointer.py ├── 139-word-break ├── 139-word-break.py ├── NOTES.md └── README.md ├── 1393-capital-gain-loss ├── 1393-capital-gain-loss.sql └── README.md ├── 1395-count-number-of-teams ├── 1395-count-number-of-teams.py ├── NOTES.md └── README.md ├── 139_Word_Break.py ├── 14-longest-common-prefix ├── 14-longest-common-prefix.py ├── NOTES.md └── README.md ├── 140-word-break-ii ├── 140-word-break-ii.py ├── NOTES.md └── README.md ├── 1402-reducing-dishes ├── 1402-reducing-dishes.py ├── NOTES.md └── README.md ├── 1405-longest-happy-string ├── 1405-longest-happy-string.py ├── NOTES.md └── README.md ├── 1407-top-travellers ├── 1407-top-travellers.sql ├── NOTES.md └── README.md ├── 140_Word_Break_II.py ├── 141-linked-list-cycle ├── 141-linked-list-cycle.py ├── NOTES.md └── README.md ├── 141_Linked_List_Cycle.py ├── 142-linked-list-cycle-ii ├── 142-linked-list-cycle-ii.py ├── NOTES.md └── README.md ├── 1423-maximum-points-you-can-obtain-from-cards ├── 1423-maximum-points-you-can-obtain-from-cards.py ├── NOTES.md └── README.md ├── 142_Linked_List_Cycle_II.py ├── 143-reorder-list ├── 143-reorder-list.py ├── NOTES.md └── README.md ├── 143_Reorder_List.py ├── 144-binary-tree-preorder-traversal ├── 144-binary-tree-preorder-traversal.py ├── NOTES.md └── README.md ├── 1444-number-of-ways-of-cutting-a-pizza ├── 1444-number-of-ways-of-cutting-a-pizza.py ├── NOTES.md └── README.md ├── 1446-consecutive-characters ├── 1446-consecutive-characters.py ├── NOTES.md └── README.md ├── 1448-count-good-nodes-in-binary-tree ├── 1448-count-good-nodes-in-binary-tree.py └── NOTES.md ├── 144_Binary_Tree_Preorder_Traversal.py ├── 145_Binary_Tree_Postorder_Traversal.py ├── 146-lru-cache ├── 146-lru-cache.py ├── NOTES.md └── README.md ├── 1461-check-if-a-string-contains-all-binary-codes-of-size-k ├── 1461-check-if-a-string-contains-all-binary-codes-of-size-k.py ├── NOTES.md └── README.md ├── 1465-maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts ├── 1465-maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts.py ├── NOTES.md └── README.md ├── 1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero ├── 1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.py ├── NOTES.md └── README.md ├── 146_LRU_Cache.py ├── 147-insertion-sort-list ├── 147-insertion-sort-list.py ├── NOTES.md └── README.md ├── 1472-design-browser-history ├── 1472-design-browser-history.py ├── NOTES.md └── README.md ├── 147_Insertion_Sort_List.py ├── 148-sort-list ├── 148-sort-list.py └── NOTES.md ├── 1480-running-sum-of-1d-array ├── 1480-running-sum-of-1d-array.py ├── NOTES.md └── README.md ├── 1480_Running_Sum_of_1d_Array.py ├── 1484-group-sold-products-by-the-date ├── 1484-group-sold-products-by-the-date.sql └── README.md ├── 1493-longest-subarray-of-1s-after-deleting-one-element ├── 1493-longest-subarray-of-1s-after-deleting-one-element.py ├── NOTES.md └── README.md ├── 1498-number-of-subsequences-that-satisfy-the-given-sum-condition ├── 1498-number-of-subsequences-that-satisfy-the-given-sum-condition.py └── README.md ├── 149_Max_Points_on_a_Line.py ├── 15-3sum ├── 15-3sum.py ├── NOTES.md └── README.md ├── 1508-range-sum-of-sorted-subarray-sums ├── 1508-range-sum-of-sorted-subarray-sums.py └── README.md ├── 1509-minimum-difference-between-largest-and-smallest-value-in-three-moves ├── 1509-minimum-difference-between-largest-and-smallest-value-in-three-moves.py ├── NOTES.md └── README.md ├── 150_Evaluate_Reverse_Polish_Notation.py ├── 151-reverse-words-in-a-string ├── 151-reverse-words-in-a-string.py ├── NOTES.md └── README.md ├── 151_Reverse_Words_in_a_String.py ├── 152-maximum-product-subarray ├── 152-maximum-product-subarray.py ├── NOTES.md └── README.md ├── 1525-number-of-good-ways-to-split-a-string ├── 1525-number-of-good-ways-to-split-a-string.py └── README.md ├── 1527-patients-with-a-condition ├── 1527-patients-with-a-condition.sql └── README.md ├── 152_Maximum_Product_Subarray.py ├── 153-find-minimum-in-rotated-sorted-array ├── 153-find-minimum-in-rotated-sorted-array.py └── README.md ├── 1530-number-of-good-leaf-nodes-pairs ├── 1530-number-of-good-leaf-nodes-pairs.py ├── NOTES.md └── README.md ├── 1538-maximum-points-you-can-obtain-from-cards ├── 1538-maximum-points-you-can-obtain-from-cards.py └── README.md ├── 1539-kth-missing-positive-number ├── 1539-kth-missing-positive-number.py ├── NOTES.md └── README.md ├── 153_Find_Minimum_in_Rotated_Sorted_Array.py ├── 1545-find-kth-bit-in-nth-binary-string ├── 1545-find-kth-bit-in-nth-binary-string.py ├── NOTES.md └── README.md ├── 154_Find_Minimum_in_Rotated_Sorted_Array_II.py ├── 155-min-stack ├── 155-min-stack.py ├── NOTES.md └── README.md ├── 155_Min_Stack.py ├── 156_Binary_Tree_Upside_Down.py ├── 157_Read_N_Characters_Given_Read4.py ├── 1581-customer-who-visited-but-did-not-make-any-transactions ├── 1581-customer-who-visited-but-did-not-make-any-transactions.sql └── NOTES.md ├── 1584-min-cost-to-connect-all-points ├── 1584-min-cost-to-connect-all-points.py ├── NOTES.md └── README.md ├── 1587-bank-account-summary-ii ├── 1587-bank-account-summary-ii.sql └── README.md ├── 158_Read_N_Characters_Given_Read4_II_Call_multiple_times.py ├── 1599_Maximum_Profit_of_Operating_a_Centennial_Wheel.py ├── 159_Longest_Substring_with_At_Most_Two_Distinct_Characters.py ├── 16-3sum-closest ├── 16-3sum-closest.py ├── NOTES.md └── README.md ├── 160-intersection-of-two-linked-lists ├── 160-intersection-of-two-linked-lists.py ├── NOTES.md └── README.md ├── 1605-find-valid-matrix-given-row-and-column-sums ├── 1605-find-valid-matrix-given-row-and-column-sums.py ├── NOTES.md └── README.md ├── 160_Intersection_of_Two_Linked_Lists.py ├── 1614-maximum-nesting-depth-of-the-parentheses ├── 1614-maximum-nesting-depth-of-the-parentheses.py ├── NOTES.md └── README.md ├── 161_One_Edit_Distance.py ├── 162-find-peak-element ├── 162-find-peak-element.py ├── NOTES.md └── README.md ├── 162_Find_Peak_Element.py ├── 1631-path-with-minimum-effort ├── 1631-path-with-minimum-effort.py ├── NOTES.md └── README.md ├── 163_Missing_Ranges.py ├── 165-compare-version-numbers ├── 165-compare-version-numbers.py ├── NOTES.md └── README.md ├── 165_Compare_Version_Numbers.py ├── 166-fraction-to-recurring-decimal ├── 166-fraction-to-recurring-decimal.py └── README.md ├── 1667-fix-names-in-a-table ├── 1667-fix-names-in-a-table.sql ├── NOTES.md └── README.md ├── 166_Fraction_to_Recurring_Decimal.py ├── 1673-find-the-most-competitive-subsequence ├── 1673-find-the-most-competitive-subsequence.py ├── NOTES.md └── README.md ├── 167_Two_Sum_II_Input_array_is_sorted.py ├── 1685-sum-of-absolute-differences-in-a-sorted-array ├── 1685-sum-of-absolute-differences-in-a-sorted-array.py ├── NOTES.md └── README.md ├── 168_Excel_Sheet_Column_Title.py ├── 169-majority-element ├── 169-majority-element.py ├── NOTES.md └── README.md ├── 1693-daily-leads-and-partners ├── 1693-daily-leads-and-partners.sql ├── NOTES.md └── README.md ├── 1695-maximum-erasure-value ├── 1695-maximum-erasure-value.py ├── NOTES.md └── README.md ├── 17-letter-combinations-of-a-phone-number ├── 17-letter-combinations-of-a-phone-number.py ├── NOTES.md └── README.md ├── 170_Two_Sum_III-Data_structure_design.py ├── 1710-maximum-units-on-a-truck ├── 1710-maximum-units-on-a-truck.py ├── NOTES.md └── README.md ├── 172-factorial-trailing-zeroes ├── 172-factorial-trailing-zeroes.py ├── NOTES.md └── README.md ├── 1729-find-followers-count ├── 1729-find-followers-count.sql ├── NOTES.md └── README.md ├── 173-binary-search-tree-iterator ├── 173-binary-search-tree-iterator.py ├── NOTES.md └── README.md ├── 1741-find-total-time-spent-by-each-employee ├── 1741-find-total-time-spent-by-each-employee.sql ├── NOTES.md └── README.md ├── 1757-recyclable-and-low-fat-products ├── 1757-recyclable-and-low-fat-products.sql ├── NOTES.md └── README.md ├── 179-largest-number ├── 179-largest-number.py ├── NOTES.md └── README.md ├── 1795-rearrange-products-table ├── 1795-rearrange-products-table.sql ├── NOTES.md └── README.md ├── 179_Largest_Number.py ├── 18-4sum ├── 18-4sum.py ├── NOTES.md └── README.md ├── 1813-maximum-erasure-value ├── 1813-maximum-erasure-value.py └── README.md ├── 1829-maximum-units-on-a-truck ├── 1829-maximum-units-on-a-truck.py └── README.md ├── 1834-single-threaded-cpu ├── 1834-single-threaded-cpu.py └── README.md ├── 1838-frequency-of-the-most-frequent-element ├── 1838-frequency-of-the-most-frequent-element.py └── README.md ├── 1844-replace-all-digits-with-characters ├── 1844-replace-all-digits-with-characters.py ├── NOTES.md └── README.md ├── 1845-seat-reservation-manager ├── 1845-seat-reservation-manager.py ├── NOTES.md └── README.md ├── 1849-splitting-a-string-into-descending-consecutive-values ├── 1849-splitting-a-string-into-descending-consecutive-values.py ├── NOTES.md └── README.md ├── 1851-minimum-interval-to-include-each-query ├── 1851-minimum-interval-to-include-each-query.py ├── NOTES.md └── README.md ├── 1855-maximum-distance-between-a-pair-of-values ├── 1855-maximum-distance-between-a-pair-of-values.py ├── NOTES.md └── README.md ├── 1856-maximum-subarray-min-product ├── 1856-maximum-subarray-min-product.py └── README.md ├── 1866-number-of-ways-to-rearrange-sticks-with-k-sticks-visible ├── 1866-number-of-ways-to-rearrange-sticks-with-k-sticks-visible.py └── NOTES.md ├── 186_Reverse_Words_in_a_String_II.py ├── 187-repeated-dna-sequences ├── 187-repeated-dna-sequences.py └── README.md ├── 1871-jump-game-vii ├── 1871-jump-game-vii.py └── NOTES.md ├── 1873-calculate-special-bonus ├── 1873-calculate-special-bonus.sql ├── NOTES.md └── README.md ├── 188-best-time-to-buy-and-sell-stock-iv ├── 188-best-time-to-buy-and-sell-stock-iv.py ├── NOTES.md └── README.md ├── 1882-process-tasks-using-servers ├── 1882-process-tasks-using-servers.py └── NOTES.md ├── 1884-egg-drop-with-2-eggs-and-n-floors ├── 1884-egg-drop-with-2-eggs-and-n-floors.py ├── NOTES.md └── README.md ├── 1888-minimum-number-of-flips-to-make-the-binary-string-alternating ├── 1888-minimum-number-of-flips-to-make-the-binary-string-alternating.py ├── NOTES.md └── README.md ├── 189-rotate-array ├── 189-rotate-array.py └── NOTES.md ├── 1890-the-latest-login-in-2020 ├── 1890-the-latest-login-in-2020.sql ├── NOTES.md └── README.md ├── 1898-maximum-number-of-removable-characters ├── 1898-maximum-number-of-removable-characters.py └── NOTES.md ├── 19-remove-nth-node-from-end-of-list ├── 19-remove-nth-node-from-end-of-list.py ├── NOTES.md └── README.md ├── 190-reverse-bits ├── 190-reverse-bits.py └── README.md ├── 1905-count-sub-islands ├── 1905-count-sub-islands.py ├── NOTES.md └── README.md ├── 1911-maximum-alternating-subsequence-sum ├── 1911-maximum-alternating-subsequence-sum.py ├── NOTES.md └── README.md ├── 191_Number_of_1_Bits.py ├── 1921-eliminate-maximum-number-of-monsters ├── 1921-eliminate-maximum-number-of-monsters.py ├── NOTES.md └── README.md ├── 1922-count-good-numbers ├── 1922-count-good-numbers.py ├── NOTES.md └── README.md ├── 1930-unique-length-3-palindromic-subsequences ├── 1930-unique-length-3-palindromic-subsequences.py ├── NOTES.md └── README.md ├── 1963-minimum-number-of-swaps-to-make-the-string-balanced ├── 1963-minimum-number-of-swaps-to-make-the-string-balanced.py ├── NOTES.md └── README.md ├── 1965-employees-with-missing-information ├── 1965-employees-with-missing-information.sql ├── NOTES.md └── README.md ├── 1966-frequency-of-the-most-frequent-element ├── 1966-frequency-of-the-most-frequent-element.py └── README.md ├── 1968-array-with-elements-not-equal-to-average-of-neighbors ├── 1968-array-with-elements-not-equal-to-average-of-neighbors.py ├── NOTES.md └── README.md ├── 1971-find-if-path-exists-in-graph ├── 1971-find-if-path-exists-in-graph.py └── NOTES.md ├── 1974-minimum-time-to-type-word-using-special-typewriter ├── 1974-minimum-time-to-type-word-using-special-typewriter.py ├── NOTES.md └── README.md ├── 1979-find-greatest-common-divisor-of-array ├── 1979-find-greatest-common-divisor-of-array.py └── README.md ├── 198-house-robber ├── 198-house-robber.py ├── NOTES.md └── README.md ├── 1980-find-unique-binary-string ├── 1980-find-unique-binary-string.py ├── NOTES.md └── README.md ├── 1984-minimum-difference-between-highest-and-lowest-of-k-scores ├── 1984-minimum-difference-between-highest-and-lowest-of-k-scores.py └── README.md ├── 1985-find-the-kth-largest-integer-in-the-array ├── 1985-find-the-kth-largest-integer-in-the-array.py └── README.md ├── 198_House_Robber.py ├── 199-binary-tree-right-side-view ├── 199-binary-tree-right-side-view.py ├── NOTES.md └── README.md ├── 2-add-two-numbers ├── 2-add-two-numbers.py ├── NOTES.md └── README.md ├── 20-valid-parentheses ├── 20-valid-parentheses.py ├── NOTES.md └── README.md ├── 200-number-of-islands ├── 200-number-of-islands.py ├── NOTES.md └── README.md ├── 2001-jump-game-vii ├── 2001-jump-game-vii.py └── README.md ├── 2001-number-of-pairs-of-interchangeable-rectangles ├── 2001-number-of-pairs-of-interchangeable-rectangles.py ├── NOTES.md └── README.md ├── 2006-count-number-of-pairs-with-absolute-difference-k ├── 2006-count-number-of-pairs-with-absolute-difference-k.py ├── NOTES.md └── README.md ├── 200_Number_of_Islands.py ├── 2017-minimum-number-of-flips-to-make-the-binary-string-alternating ├── 2017-minimum-number-of-flips-to-make-the-binary-string-alternating.py └── README.md ├── 202-happy-number ├── 202-happy-number.py └── NOTES.md ├── 2024-maximize-the-confusion-of-an-exam ├── 2024-maximize-the-confusion-of-an-exam.py └── NOTES.md ├── 202_Happy_Number.py ├── 2035-count-sub-islands ├── 2035-count-sub-islands.py └── README.md ├── 203_Remove_Linked_List_Elements.py ├── 2044-count-number-of-maximum-bitwise-or-subsets ├── 2044-count-number-of-maximum-bitwise-or-subsets.py └── README.md ├── 204_Count_Primes.py ├── 205_Isomorphic_Strings.py ├── 206-reverse-linked-list ├── 206-reverse-linked-list.py ├── NOTES.md └── README.md ├── 206_Reverse_Linked_List.py ├── 207-course-schedule ├── 207-course-schedule.py ├── NOTES.md └── README.md ├── 208-implement-trie-prefix-tree ├── 208-implement-trie-prefix-tree.py ├── NOTES.md └── README.md ├── 208_Implement_Trie_(Prefix_Tree).py ├── 209-minimum-size-subarray-sum ├── 209-minimum-size-subarray-sum.py ├── NOTES.md └── README.md ├── 2091-removing-minimum-and-maximum-from-array ├── 2091-removing-minimum-and-maximum-from-array.py └── NOTES.md ├── 21-merge-two-sorted-lists ├── 21-merge-two-sorted-lists.py ├── NOTES.md └── README.md ├── 210-course-schedule-ii ├── 210-course-schedule-ii.py ├── NOTES.md └── README.md ├── 211-design-add-and-search-words-data-structure ├── 211-design-add-and-search-words-data-structure.py ├── NOTES.md └── README.md ├── 213-house-robber-ii ├── 213-house-robber-ii.py ├── NOTES.md └── README.md ├── 213_House_Robber_II.py ├── 214-shortest-palindrome ├── 214-shortest-palindrome.py ├── NOTES.md └── README.md ├── 215-kth-largest-element-in-an-array ├── 215-kth-largest-element-in-an-array.py ├── NOTES.md └── README.md ├── 215_Kth_Largest_Element_in_an_Array.py ├── 216_Combination_Sum_III.py ├── 217_Contains_Duplicate.py ├── 2187-minimum-time-to-complete-trips ├── 2187-minimum-time-to-complete-trips.py ├── NOTES.md └── README.md ├── 219_Contains_Duplicate_II.py ├── 22-generate-parentheses ├── 22-generate-parentheses.py ├── NOTES.md └── README.md ├── 220_Contains_Duplicate_III.py ├── 221-maximal-square ├── 221-maximal-square.py └── NOTES.md ├── 221_Maximal_Square.py ├── 222-count-complete-tree-nodes ├── 222-count-complete-tree-nodes.py ├── NOTES.md └── README.md ├── 223_Rectangle Area.py ├── 224-basic-calculator ├── 224-basic-calculator.py ├── NOTES.md └── README.md ├── 2241-design-an-atm-machine ├── 2241-design-an-atm-machine.py ├── NOTES.md └── README.md ├── 225-implement-stack-using-queues ├── 225-implement-stack-using-queues.py ├── NOTES.md └── README.md ├── 225_Implement_Stack_using_Queues.py ├── 226-invert-binary-tree ├── 226-invert-binary-tree.py └── README.md ├── 226_Invert_Binary_Tree.py ├── 227-basic-calculator-ii ├── 227-basic-calculator-ii.py ├── NOTES.md └── README.md ├── 2271-maximum-white-tiles-covered-by-a-carpet ├── 2271-maximum-white-tiles-covered-by-a-carpet.py ├── NOTES.md └── README.md ├── 228-summary-ranges ├── 228-summary-ranges.py └── NOTES.md ├── 228_Summary_Ranges.py ├── 229-majority-element-ii ├── 229-majority-element-ii.py ├── NOTES.md └── README.md ├── 2296-design-a-text-editor ├── 2296-design-a-text-editor.py ├── NOTES.md └── README.md ├── 229_Majority_Element_II.py ├── 23-merge-k-sorted-lists ├── 23-merge-k-sorted-lists.py ├── NOTES.md └── README.md ├── 230-kth-smallest-element-in-a-bst ├── 230-kth-smallest-element-in-a-bst.py ├── NOTES.md └── README.md ├── 2300-successful-pairs-of-spells-and-potions └── NOTES.md ├── 2301-match-substring-after-replacement ├── 2301-match-substring-after-replacement.py ├── NOTES.md └── README.md ├── 2302-count-subarrays-with-score-less-than-k ├── 2302-count-subarrays-with-score-less-than-k.py ├── NOTES.md └── README.md ├── 2304-minimum-path-cost-in-a-grid ├── 2304-minimum-path-cost-in-a-grid.py ├── NOTES.md └── README.md ├── 2305-fair-distribution-of-cookies ├── 2305-fair-distribution-of-cookies.py └── README.md ├── 2316-count-unreachable-pairs-of-nodes-in-an-undirected-graph ├── 2316-count-unreachable-pairs-of-nodes-in-an-undirected-graph.py └── README.md ├── 231_Power_of_Two.py ├── 232-implement-queue-using-stacks ├── 232-implement-queue-using-stacks.py ├── NOTES.md └── README.md ├── 2320-count-number-of-ways-to-place-houses ├── 2320-count-number-of-ways-to-place-houses.py ├── NOTES.md └── README.md ├── 2321-maximum-score-of-spliced-array ├── 2321-maximum-score-of-spliced-array.py ├── NOTES.md └── README.md ├── 232_Implement_Queue_using_Stacks.py ├── 234-palindrome-linked-list ├── 234-palindrome-linked-list.py ├── NOTES.md └── README.md ├── 2348-number-of-zero-filled-subarrays ├── 2348-number-of-zero-filled-subarrays.py └── NOTES.md ├── 234_Palindrome_Linked_List.py ├── 235-lowest-common-ancestor-of-a-binary-search-tree ├── 235-lowest-common-ancestor-of-a-binary-search-tree.py ├── NOTES.md └── README.md ├── 235_Lowest_Common_Ancestor_of_a_Binary_Search_Tree.py ├── 236-lowest-common-ancestor-of-a-binary-tree ├── 236-lowest-common-ancestor-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 2360-longest-cycle-in-a-graph ├── 2360-longest-cycle-in-a-graph.py ├── NOTES.md └── README.md ├── 236_Lowest_Common_Ancestor_of_a_Binary_Tree.py ├── 237-delete-node-in-a-linked-list ├── 237-delete-node-in-a-linked-list.py ├── NOTES.md └── README.md ├── 237_Delete_Node_in_a_Linked_List.py ├── 238-product-of-array-except-self ├── 238-product-of-array-except-self.py ├── NOTES.md └── README.md ├── 238_Product_of_Array_Except_Self.py ├── 239-sliding-window-maximum ├── 239-sliding-window-maximum.py ├── NOTES.md └── README.md ├── 2409-count-days-spent-together ├── 2409-count-days-spent-together.py ├── NOTES.md └── README.md ├── 241-different-ways-to-add-parentheses ├── 241-different-ways-to-add-parentheses.py ├── NOTES.md └── README.md ├── 2411-smallest-subarrays-with-maximum-bitwise-or ├── 2411-smallest-subarrays-with-maximum-bitwise-or.py ├── NOTES.md └── README.md ├── 242-valid-anagram ├── 242-valid-anagram.py ├── NOTES.md └── README.md ├── 2423-remove-letter-to-equalize-frequency ├── 2423-remove-letter-to-equalize-frequency.py ├── NOTES.md └── README.md ├── 242_Valid_Anagram.py ├── 243_Shortest_Word_Distance.py ├── 2444-count-subarrays-with-fixed-bounds ├── 2444-count-subarrays-with-fixed-bounds.py ├── NOTES.md └── README.md ├── 2448-minimum-cost-to-make-array-equal ├── 2448-minimum-cost-to-make-array-equal.py ├── NOTES.md └── README.md ├── 2449-minimum-number-of-operations-to-make-arrays-similar ├── 2449-minimum-number-of-operations-to-make-arrays-similar.py ├── NOTES.md └── README.md ├── 2452-words-within-two-edits-of-dictionary ├── 2452-words-within-two-edits-of-dictionary.py ├── NOTES.md └── README.md ├── 246_Strobogrammatic_Number.py ├── 2477-minimum-fuel-cost-to-report-to-the-capital ├── 2477-minimum-fuel-cost-to-report-to-the-capital.py ├── NOTES.md └── README.md ├── 2488-count-subarrays-with-median-k ├── 2488-count-subarrays-with-median-k.py ├── NOTES.md └── README.md ├── 2492-minimum-score-of-a-path-between-two-cities ├── 2492-minimum-score-of-a-path-between-two-cities.py ├── NOTES.md └── README.md ├── 2498-frog-jump-ii ├── NOTES.md └── README.md ├── 249_Group_Shifted_Strings.py ├── 25-reverse-nodes-in-k-group ├── 25-reverse-nodes-in-k-group.py ├── NOTES.md └── README.md ├── 2508-add-edges-to-make-degrees-of-all-nodes-even ├── 2508-add-edges-to-make-degrees-of-all-nodes-even.py ├── NOTES.md └── README.md ├── 2527-count-subarrays-with-fixed-bounds ├── 2527-count-subarrays-with-fixed-bounds.py └── README.md ├── 252_Meeting_Rooms.py ├── 253_Meeting_Rooms_II.py ├── 2546-apply-bitwise-operations-to-make-strings-equal ├── 2546-apply-bitwise-operations-to-make-strings-equal.py ├── NOTES.md └── README.md ├── 2564-substring-xor-queries ├── 2564-substring-xor-queries.py ├── NOTES.md └── README.md ├── 2565-subsequence-with-the-minimum-score ├── 2565-subsequence-with-the-minimum-score.py ├── NOTES.md └── README.md ├── 2576-find-the-maximum-number-of-marked-indices ├── 2576-find-the-maximum-number-of-marked-indices.py └── README.md ├── 257_Binary_Tree_Paths.py ├── 258-add-digits ├── 258-add-digits.py ├── NOTES.md └── README.md ├── 258_Add_Digits.py ├── 2597-the-number-of-beautiful-subsets ├── 2597-the-number-of-beautiful-subsets.py ├── NOTES.md └── README.md ├── 259_3Sum_Smaller.py ├── 26-remove-duplicates-from-sorted-array ├── 26-remove-duplicates-from-sorted-array.py └── NOTES.md ├── 2611-mice-and-cheese ├── 2611-mice-and-cheese.py ├── NOTES.md └── README.md ├── 263_Ugly_Number.py ├── 264_Ugly_Number_II.py ├── 266_Palindrome_Permutation.py ├── 267_Palindrome_Permutation_II.py ├── 268_Missing_Number.py ├── 270_Closest_Binary_Search_Tree_Value.py ├── 273_Integer_to_English_Words.py ├── 274_H-Index.py ├── 276_Paint_Fence.py ├── 278_First_Bad_Version.py ├── 279-perfect-squares ├── 279-perfect-squares.py ├── NOTES.md └── README.md ├── 28-implement-strstr ├── 28-implement-strstr.py └── README.md ├── 280_Wiggle_Sort.py ├── 283_Move Zeroes.py ├── 286_Walls_and_Gates.py ├── 287-find-the-duplicate-number ├── 287-find-the-duplicate-number.py ├── NOTES.md └── README.md ├── 288_Unique_Word_Abbreviation.py ├── 290_Word_Pattern.py ├── 292_Nim_Game.py ├── 293_Flip_Game.py ├── 294_Flip_Game_II.py ├── 295-find-median-from-data-stream ├── 295-find-median-from-data-stream.py ├── NOTES.md └── README.md ├── 296_Best_Meeting_Point.py ├── 297-serialize-and-deserialize-binary-tree ├── 297-serialize-and-deserialize-binary-tree.py ├── NOTES.md └── README.md ├── 298_Binary_Tree_Longest_Consecutive_Sequence.py ├── 299_Bulls_and_Cows.py ├── 3-longest-substring-without-repeating-characters ├── 3-longest-substring-without-repeating-characters.py ├── NOTES.md └── README.md ├── 300-longest-increasing-subsequence ├── 300-longest-increasing-subsequence.py ├── NOTES.md └── README.md ├── 303_Range_Sum_Query_Immutable.py ├── 304_Range_Sum_Query_2D_Immutable.py ├── 305_Number_of_Islands_II.py ├── 307_Range_Sum_Query_Mutable.py ├── 309-best-time-to-buy-and-sell-stock-with-cooldown ├── 309-best-time-to-buy-and-sell-stock-with-cooldown.py ├── NOTES.md └── README.md ├── 31-next-permutation ├── 31-next-permutation.py ├── NOTES.md └── README.md ├── 316-remove-duplicate-letters ├── 316-remove-duplicate-letters.py ├── NOTES.md └── README.md ├── 322-coin-change ├── 322-coin-change.py ├── NOTES.md └── README.md ├── 322_Coin_Change.py ├── 326_Power_of_Three.py ├── 328_Odd_Even_Linked_List.py ├── 329-longest-increasing-path-in-a-matrix ├── 329-longest-increasing-path-in-a-matrix.py ├── NOTES.md └── README.md ├── 33-search-in-rotated-sorted-array ├── 33-search-in-rotated-sorted-array.py ├── NOTES.md └── README.md ├── 336_Palindrome_Pairs.py ├── 337-house-robber-iii ├── 337-house-robber-iii.py ├── NOTES.md └── README.md ├── 337_House_Robber_III.py ├── 338-counting-bits ├── 338-counting-bits.py └── README.md ├── 338_Counting_Bits.py ├── 339_Nested_List_Weight_Sum.py ├── 34-find-first-and-last-position-of-element-in-sorted-array ├── 34-find-first-and-last-position-of-element-in-sorted-array.py └── README.md ├── 340_Longest_Substring_with_At_Most_K_Distinct_Characters.py ├── 342_Power_of_Four.py ├── 343-integer-break ├── 343-integer-break.py ├── NOTES.md └── README.md ├── 344-reverse-string ├── 344-reverse-string.py ├── NOTES.md └── README.md ├── 344_Reverse_String.py ├── 345_Reverse_Vowels_of_a_String.py ├── 346_Moving_Average_from_Data_Stream.py ├── 347-top-k-frequent-elements ├── 347-top-k-frequent-elements.py ├── NOTES.md └── README.md ├── 347_Top_K_Frequent_Elements.py ├── 349-intersection-of-two-arrays └── NOTES.md ├── 349_Intersection_of_Two_Arrays.py ├── 350-intersection-of-two-arrays-ii ├── 350-intersection-of-two-arrays-ii.py └── README.md ├── 350_Intersection_of_Two_Arrays_II.py ├── 351_Android_Unlock_Patterns.py ├── 359_Logger_Rate_Limiter.py ├── 36-valid-sudoku ├── 36-valid-sudoku.py ├── NOTES.md └── README.md ├── 366_Find_Leaves_of_Binary_Tree.py ├── 367_Valid_Perfect_Square.py ├── 368_Largest_Divisible_Subset.py ├── 369_Plus_One_Linked_List.py ├── 37-sudoku-solver ├── 37-sudoku-solver.py ├── NOTES.md └── README.md ├── 370_Range_Addition.py ├── 371-sum-of-two-integers ├── 371-sum-of-two-integers.py └── NOTES.md ├── 371_Sum_of_Two_Integers.py ├── 372_Super_Pow.py ├── 373_Find_K_Pairs_with_Smallest_Sums.py ├── 374_Guess_Number_Higher_or_Lower.py ├── 375_Guess_Number_Higher_or_Lower_II.py ├── 378-kth-smallest-element-in-a-sorted-matrix ├── 378-kth-smallest-element-in-a-sorted-matrix.py ├── NOTES.md └── README.md ├── 38-count-and-say ├── 38-count-and-say.py ├── NOTES.md └── README.md ├── 383_Ransom_Note.py ├── 384_Shuffle_an_Array.py ├── 386-lexicographical-numbers ├── 386-lexicographical-numbers.py ├── NOTES.md └── README.md ├── 387-first-unique-character-in-a-string ├── 387-first-unique-character-in-a-string.py ├── NOTES.md └── README.md ├── 387_First_Unique_Character_in_a_String.py ├── 388_Longest_Absolute_File_Path.py ├── 389-find-the-difference ├── 389-find-the-difference.py ├── NOTES.md └── README.md ├── 389_Find_the_Difference.py ├── 39-combination-sum ├── 39-combination-sum.py ├── NOTES.md └── README.md ├── 392-is-subsequence ├── 392-is-subsequence.py ├── NOTES.md └── README.md ├── 394-decode-string ├── 394-decode-string.py ├── NOTES.md └── README.md ├── 397-integer-replacement ├── 397-integer-replacement.py ├── NOTES.md └── README.md ├── 4-median-of-two-sorted-arrays ├── 4-median-of-two-sorted-arrays.py ├── NOTES.md └── README.md ├── 40-combination-sum-ii ├── 40-combination-sum-ii.py ├── NOTES.md └── README.md ├── 400_Nth_Digit.py ├── 401_Binary_Watch.py ├── 402-remove-k-digits ├── 402-remove-k-digits.py ├── NOTES.md └── README.md ├── 404-sum-of-left-leaves ├── 404-sum-of-left-leaves.py ├── NOTES.md └── README.md ├── 404_Sum_of_Left_Leaves.py ├── 405_Convert_a_Number_to_Hexadecimal.py ├── 406-queue-reconstruction-by-height ├── 406-queue-reconstruction-by-height.py ├── NOTES.md └── README.md ├── 408_Valid_Word_Abbreviation.py ├── 409-longest-palindrome ├── 409-longest-palindrome.py └── NOTES.md ├── 409_Longest_Palindrome.py ├── 412_Fizz_Buzz.py ├── 414_Third_Maximum_Number.py ├── 415_Add_Strings.py ├── 416-partition-equal-subset-sum ├── 416-partition-equal-subset-sum.py ├── NOTES.md └── README.md ├── 416_Partition_Equal_Subset_Sum.py ├── 42-trapping-rain-water ├── 42-trapping-rain-water.py ├── NOTES.md └── README.md ├── 421-maximum-xor-of-two-numbers-in-an-array ├── 421-maximum-xor-of-two-numbers-in-an-array.py ├── NOTES.md └── README.md ├── 421_Maximum_XOR_of_Two_Numbers_in_an_Array.py ├── 422_Valid_Word_Square.py ├── 43-multiply-strings ├── 43-multiply-strings.py └── NOTES.md ├── 430-flatten-a-multilevel-doubly-linked-list ├── 430-flatten-a-multilevel-doubly-linked-list.py ├── NOTES.md └── README.md ├── 434_Number_of_Segments_in_a_String.py ├── 435-non-overlapping-intervals ├── 435-non-overlapping-intervals.py ├── NOTES.md └── README.md ├── 437-path-sum-iii ├── 437-path-sum-iii.py ├── NOTES.md └── README.md ├── 437_Path_Sum_III.py ├── 438-find-all-anagrams-in-a-string ├── 438-find-all-anagrams-in-a-string.py └── README.md ├── 438_Find_All_Anagrams_in_a_String.py ├── 44-wildcard-matching ├── 44-wildcard-matching.py └── NOTES.md ├── 443_String_Compression.py ├── 448-find-all-numbers-disappeared-in-an-array ├── 448-find-all-numbers-disappeared-in-an-array.py ├── NOTES.md └── README.md ├── 448_Find_All_Numbers_Disappeared_in_an_Array.py ├── 45-jump-game-ii ├── 45-jump-game-ii.py ├── NOTES.md └── README.md ├── 452-minimum-number-of-arrows-to-burst-balloons ├── 452-minimum-number-of-arrows-to-burst-balloons.py ├── NOTES.md └── README.md ├── 453_Minimum_Moves_to_Equal_Array_Elements.py ├── 457_Circular_Array_Loop.py ├── 458_Poor_Pigs.py ├── 46-permutations ├── 46-permutations.py ├── NOTES.md └── README.md ├── 461-hamming-distance ├── 461-hamming-distance.py └── NOTES.md ├── 461_Hamming_Distance.py ├── 463_Island_Perimeter.py ├── 47-permutations-ii ├── 47-permutations-ii.py └── NOTES.md ├── 474-ones-and-zeroes ├── 474-ones-and-zeroes.py ├── NOTES.md └── README.md ├── 475_Heaters.py ├── 477-total-hamming-distance ├── 477-total-hamming-distance.py └── README.md ├── 479_Largest_Palindrome_Product.py ├── 48-rotate-image ├── 48-rotate-image.py ├── NOTES.md └── README.md ├── 482_License_Key_Formatting.py ├── 485-max-consecutive-ones ├── 485-max-consecutive-ones.py ├── NOTES.md └── README.md ├── 485_Max_Consecutive_Ones.py ├── 493-reverse-pairs ├── 493-reverse-pairs.py ├── NOTES.md └── README.md ├── 494-target-sum ├── 494-target-sum.py ├── NOTES.md └── README.md ├── 496-next-greater-element-i ├── 496-next-greater-element-i.py ├── NOTES.md └── README.md ├── 5-longest-palindromic-substring ├── 5-longest-palindromic-substring.py ├── NOTES.md └── README.md ├── 50-powx-n ├── 50-powx-n.py ├── NOTES.md └── README.md ├── 509_Fibonacci_Number.py ├── 51-n-queens ├── 51-n-queens.py ├── NOTES.md └── README.md ├── 516-longest-palindromic-subsequence ├── 516-longest-palindromic-subsequence.py ├── NOTES.md └── README.md ├── 518-coin-change-2 ├── 518-coin-change-2.py ├── NOTES.md └── README.md ├── 523-continuous-subarray-sum ├── 523-continuous-subarray-sum.py ├── NOTES.md └── README.md ├── 525-contiguous-array ├── 525-contiguous-array.py ├── NOTES.md └── README.md ├── 526-beautiful-arrangement ├── 526-beautiful-arrangement.py ├── NOTES.md └── README.md ├── 53-maximum-subarray ├── 53-maximum-subarray.py ├── NOTES.md └── README.md ├── 532-k-diff-pairs-in-an-array ├── 532-k-diff-pairs-in-an-array.py └── README.md ├── 535-encode-and-decode-tinyurl ├── 535-encode-and-decode-tinyurl.py ├── NOTES.md └── README.md ├── 538-convert-bst-to-greater-tree ├── 538-convert-bst-to-greater-tree.py ├── NOTES.md └── README.md ├── 538_Convert_BST_to_Greater_Tree.py ├── 54-spiral-matrix ├── 54-spiral-matrix.py ├── NOTES.md └── README.md ├── 540-single-element-in-a-sorted-array ├── 540-single-element-in-a-sorted-array.py ├── NOTES.md └── README.md ├── 541_Reverse_String_II.py ├── 542-01-matrix ├── 542-01-matrix.py ├── NOTES.md └── README.md ├── 543-diameter-of-binary-tree ├── 543-diameter-of-binary-tree.py ├── NOTES.md └── README.md ├── 543_Diameter_of_Binary_Tree.py ├── 547-number-of-provinces ├── 547-number-of-provinces.py ├── NOTES.md └── README.md ├── 547_Friend_Circles.py ├── 55-jump-game ├── 55-jump-game.py ├── NOTES.md └── README.md ├── 551-student-attendance-record-i ├── 551-student-attendance-record-i.py └── README.md ├── 556-next-greater-element-iii ├── 556-next-greater-element-iii.py ├── NOTES.md └── README.md ├── 557_Reverse_Words_in_a_String_III.py ├── 559-maximum-depth-of-n-ary-tree ├── 559-maximum-depth-of-n-ary-tree.py └── README.md ├── 56-merge-intervals ├── 56-merge-intervals.py ├── NOTES.md └── README.md ├── 560-subarray-sum-equals-k ├── 560-subarray-sum-equals-k.py └── README.md ├── 560_Subarray_Sum_Equals_K.py ├── 57-insert-interval ├── 57-insert-interval.py ├── NOTES.md └── README.md ├── 572_Subtree_of_Another_Tree.py ├── 581-shortest-unsorted-continuous-subarray ├── 581-shortest-unsorted-continuous-subarray.py └── NOTES.md ├── 581_Shortest_Unsorted_Continuous_Subarray.py ├── 583-delete-operation-for-two-strings ├── 583-delete-operation-for-two-strings.py ├── NOTES.md └── README.md ├── 589-n-ary-tree-preorder-traversal ├── 589-n-ary-tree-preorder-traversal.py ├── NOTES.md └── README.md ├── 59-spiral-matrix-ii ├── 59-spiral-matrix-ii.py └── NOTES.md ├── 60-permutation-sequence ├── 60-permutation-sequence.py ├── NOTES.md └── README.md ├── 605_Can_Place_Flowers.py ├── 61-rotate-list ├── 61-rotate-list.py ├── NOTES.md └── README.md ├── 611-valid-triangle-number ├── 611-valid-triangle-number.py ├── NOTES.md └── README.md ├── 617-merge-two-binary-trees ├── 617-merge-two-binary-trees.py ├── NOTES.md └── README.md ├── 617_Merge_Two_Binary_Trees.py ├── 62-unique-paths ├── 62-unique-paths.py ├── NOTES.md └── README.md ├── 628-maximum-product-of-three-numbers ├── 628-maximum-product-of-three-numbers.py ├── NOTES.md └── README.md ├── 628_Maximum_Product_of_Three_Numbers.py ├── 63-unique-paths-ii ├── 63-unique-paths-ii.py ├── NOTES.md └── README.md ├── 632-smallest-range-covering-elements-from-k-lists ├── README.md └── smallest-range-covering-elements-from-k-lists.py ├── 64-minimum-path-sum ├── 64-minimum-path-sum.py ├── NOTES.md └── README.md ├── 646-maximum-length-of-pair-chain ├── 646-maximum-length-of-pair-chain.py ├── NOTES.md └── README.md ├── 647-palindromic-substrings ├── 647-palindromic-substrings.py ├── NOTES.md └── README.md ├── 652-find-duplicate-subtrees ├── 652-find-duplicate-subtrees.py ├── NOTES.md └── README.md ├── 653-two-sum-iv-input-is-a-bst ├── 653-two-sum-iv-input-is-a-bst.py ├── NOTES.md └── README.md ├── 654-maximum-binary-tree ├── 654-maximum-binary-tree.py └── README.md ├── 654_Maximum_Binary_Tree.py ├── 66-plus-one ├── 66-plus-one.py └── README.md ├── 662-maximum-width-of-binary-tree ├── 662-maximum-width-of-binary-tree.py ├── NOTES.md └── README.md ├── 664-strange-printer ├── README.md └── strange-printer.py ├── 665_Non-decreasing_Array.py ├── 668_Kth_Smallest_Number_in_Multiplication_Table.py ├── 671_Second_Minimum_Node_In_a_Binary_Tree.py ├── 673-number-of-longest-increasing-subsequence ├── 673-number-of-longest-increasing-subsequence.py └── README.md ├── 674-longest-continuous-increasing-subsequence ├── 674-longest-continuous-increasing-subsequence.py ├── NOTES.md └── README.md ├── 674_Longest_Continuous_Increasing_Subsequence.py ├── 677-map-sum-pairs ├── 677-map-sum-pairs.py ├── NOTES.md └── README.md ├── 680-valid-palindrome-ii ├── 680-valid-palindrome-ii.py └── README.md ├── 680_Valid_Palindrome_II.py ├── 684-redundant-connection ├── 684-redundant-connection.py ├── NOTES.md └── README.md ├── 686-repeated-string-match ├── 686-repeated-string-match.py ├── NOTES.md └── README.md ├── 687-longest-univalue-path ├── 687-longest-univalue-path.py └── NOTES.md ├── 688-knight-probability-in-chessboard ├── 688-knight-probability-in-chessboard.py ├── NOTES.md └── README.md ├── 692-top-k-frequent-words ├── 692-top-k-frequent-words.py └── NOTES.md ├── 692_Top_K_Frequent_Words.py ├── 695-max-area-of-island ├── 695-max-area-of-island.py ├── NOTES.md └── README.md ├── 695_Max_Area_of_Island.py ├── 697_Degree_of_an_Array.py ├── 70-climbing-stairs ├── 70-climbing-stairs.py ├── NOTES.md └── README.md ├── 700-search-in-a-binary-search-tree ├── 700-search-in-a-binary-search-tree.py ├── NOTES.md └── README.md ├── 700_Search_in_a_Binary_Search_Tree.py ├── 703-kth-largest-element-in-a-stream ├── 703-kth-largest-element-in-a-stream.py ├── NOTES.md └── README.md ├── 703_Kth_Largest_Element_in_a_Stream.py ├── 706_Design_HashMap.py ├── 709_To_Lower_Case.py ├── 71-simplify-path ├── 71-simplify-path.py ├── NOTES.md └── README.md ├── 713-subarray-product-less-than-k ├── 713-subarray-product-less-than-k.py ├── NOTES.md └── README.md ├── 714-best-time-to-buy-and-sell-stock-with-transaction-fee ├── 714-best-time-to-buy-and-sell-stock-with-transaction-fee.py ├── NOTES.md └── README.md ├── 716_Max_Stack.py ├── 717_1-bit_and_2-bit_Characters.py ├── 72-edit-distance ├── 72-edit-distance.py ├── NOTES.md └── README.md ├── 720-longest-word-in-dictionary ├── 720-longest-word-in-dictionary.py ├── NOTES.md └── README.md ├── 720_Longest_Word_in_Dictionary.py ├── 724-find-pivot-index ├── 724-find-pivot-index.py ├── NOTES.md └── README.md ├── 724_Find_Pivot_Index.py ├── 728_Self_Dividing_Numbers.py ├── 729-my-calendar-i ├── 729-my-calendar-i.py ├── NOTES.md └── README.md ├── 73-set-matrix-zeroes ├── 73-set-matrix-zeroes.py ├── NOTES.md └── README.md ├── 731-my-calendar-ii ├── 731-my-calendar-ii.py └── NOTES.md ├── 733-flood-fill ├── 733-flood-fill.py ├── NOTES.md └── README.md ├── 733_Flood_Fill.py ├── 735-asteroid-collision ├── 735-asteroid-collision.py ├── NOTES.md └── README.md ├── 739-daily-temperatures ├── 739-daily-temperatures.py ├── NOTES.md └── README.md ├── 74-search-a-2d-matrix ├── 74-search-a-2d-matrix.py ├── NOTES.md └── README.md ├── 740-delete-and-earn ├── 740-delete-and-earn.py ├── NOTES.md └── README.md ├── 743-network-delay-time ├── 743-network-delay-time.py ├── NOTES.md └── README.md ├── 743_Network_Delay_Time.py ├── 746-min-cost-climbing-stairs ├── 746-min-cost-climbing-stairs.py ├── NOTES.md └── README.md ├── 75-sort-colors ├── 75-sort-colors.py ├── NOTES.md └── README.md ├── 751_IP_to_CIDR.py ├── 76-minimum-window-substring ├── 76-minimum-window-substring.py ├── NOTES.md └── README.md ├── 760_Find_Anagram_Mappings.py ├── 763-partition-labels ├── 763-partition-labels.py ├── NOTES.md └── README.md ├── 766_Toeplitz_Matrix.py ├── 767-reorganize-string ├── 767-reorganize-string.py ├── NOTES.md └── README.md ├── 769-max-chunks-to-make-sorted ├── 769-max-chunks-to-make-sorted.py ├── NOTES.md └── README.md ├── 77-combinations ├── 77-combinations.py ├── NOTES.md └── README.md ├── 771-jewels-and-stones ├── 771-jewels-and-stones.py └── README.md ├── 771_Jewels_and_Stones.py ├── 78-subsets ├── 78-subsets.py ├── NOTES.md └── README.md ├── 781-rabbits-in-forest ├── 781-rabbits-in-forest.py ├── NOTES.md └── README.md ├── 784_Letter_Case_Permutation.py ├── 785-is-graph-bipartite ├── 785-is-graph-bipartite.py ├── NOTES.md └── README.md ├── 787-cheapest-flights-within-k-stops ├── 787-cheapest-flights-within-k-stops.py ├── NOTES.md └── README.md ├── 79-word-search ├── 79-word-search.py ├── NOTES.md └── README.md ├── 797-all-paths-from-source-to-target ├── 797-all-paths-from-source-to-target.py ├── NOTES.md └── README.md ├── 80-remove-duplicates-from-sorted-array-ii ├── 80-remove-duplicates-from-sorted-array-ii.py ├── NOTES.md └── README.md ├── 801-minimum-swaps-to-make-sequences-increasing ├── 801-minimum-swaps-to-make-sequences-increasing.py ├── NOTES.md └── README.md ├── 804_Unique_Morse_Code_Words.py ├── 811_Subdomain_Visit_Count.py ├── 814-binary-tree-pruning ├── 814-binary-tree-pruning.py └── NOTES.md ├── 819_Most_Common_Word.py ├── 82-remove-duplicates-from-sorted-list-ii ├── 82-remove-duplicates-from-sorted-list-ii.py └── README.md ├── 823-binary-trees-with-factors ├── 823-binary-trees-with-factors.py ├── NOTES.md └── README.md ├── 832_Flipping_an_Image.py ├── 836-rectangle-overlap ├── 836-rectangle-overlap.py ├── NOTES.md └── README.md ├── 836_Rectangle_Overlap.py ├── 84-largest-rectangle-in-histogram ├── 84-largest-rectangle-in-histogram.py ├── NOTES.md └── README.md ├── 841-keys-and-rooms ├── 841-keys-and-rooms.py ├── NOTES.md └── README.md ├── 844-backspace-string-compare ├── 844-backspace-string-compare.py ├── NOTES.md └── README.md ├── 844_Backspace_String_Compare.py ├── 848-shifting-letters ├── 848-shifting-letters.py ├── NOTES.md └── README.md ├── 852_Peak_Index_in_a_Mountain_Array.py ├── 863-all-nodes-distance-k-in-binary-tree ├── 863-all-nodes-distance-k-in-binary-tree.py └── README.md ├── 867_Transpose_Matrix.py ├── 868_Binary_Gap.py ├── 87-scramble-string ├── 87-scramble-string.py ├── NOTES.md └── README.md ├── 872_Leaf-Similar_Trees.py ├── 876-middle-of-the-linked-list ├── 876-middle-of-the-linked-list.py └── NOTES.md ├── 876_Middle_of_the_Linked_List.py ├── 877-stone-game ├── 877-stone-game.py ├── NOTES.md └── README.md ├── 88-merge-sorted-array ├── 88-merge-sorted-array.py ├── NOTES.md └── README.md ├── 881-boats-to-save-people ├── 881-boats-to-save-people.py ├── NOTES.md └── README.md ├── 889-construct-binary-tree-from-preorder-and-postorder-traversal ├── 889-construct-binary-tree-from-preorder-and-postorder-traversal.py ├── NOTES.md └── README.md ├── 90-subsets-ii ├── 90-subsets-ii.py ├── NOTES.md └── README.md ├── 901-online-stock-span ├── 901-online-stock-span.py ├── NOTES.md └── README.md ├── 904_Fruit_Into_Baskets.py ├── 905_Sort_Array_By_Parity.py ├── 907-sum-of-subarray-minimums ├── 907-sum-of-subarray-minimums.py ├── NOTES.md └── README.md ├── 909-snakes-and-ladders ├── 909-snakes-and-ladders.py ├── NOTES.md └── README.md ├── 91-decode-ways ├── 91-decode-ways.py ├── NOTES.md └── README.md ├── 912-sort-an-array ├── 912-sort-an-array.py ├── NOTES.md └── README.md ├── 92-reverse-linked-list-ii ├── 92-reverse-linked-list-ii.py ├── NOTES.md └── README.md ├── 921-minimum-add-to-make-parentheses-valid ├── 921-minimum-add-to-make-parentheses-valid.py ├── NOTES.md └── README.md ├── 922_Sort_Array_By_Parity_II.py ├── 929_Unique_Email_Addresses.py ├── 93-restore-ip-addresses ├── 93-restore-ip-addresses.py └── README.md ├── 933_Number_of_Recent_Calls.py ├── 937_Reorder_Log_Files.py ├── 94-binary-tree-inorder-traversal ├── 94-binary-tree-inorder-traversal.py ├── NOTES.md └── README.md ├── 945_Minimum_Increment_to_Make_Array_Unique.py ├── 946_Validate_Stack_Sequences.py ├── 953_Verifying_an_Alien_Dictionary.py ├── 954_Array_of_Doubled_Pairs.py ├── 958-check-completeness-of-a-binary-tree ├── 958-check-completeness-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 96-unique-binary-search-trees ├── 96-unique-binary-search-trees.py ├── NOTES.md └── README.md ├── 961-n-repeated-element-in-size-2n-array ├── 961-n-repeated-element-in-size-2n-array.py └── README.md ├── 961_N-Repeated_Element_in_Size_2N_Array.py ├── 962-maximum-width-ramp ├── 962-maximum-width-ramp.py ├── NOTES.md └── README.md ├── 962_Maximum_Width_Ramp.py ├── 97-interleaving-string ├── 97-interleaving-string.py ├── NOTES.md └── README.md ├── 973-k-closest-points-to-origin ├── 973-k-closest-points-to-origin.py ├── NOTES.md └── README.md ├── 973_K_Closest_Points_to_Origin.py ├── 974-subarray-sums-divisible-by-k ├── 974-subarray-sums-divisible-by-k.py ├── NOTES.md └── README.md ├── 977_Squares_of_a_Sorted_Array.py ├── 98-validate-binary-search-tree ├── 98-validate-binary-search-tree.py ├── NOTES.md └── README.md ├── 983-minimum-cost-for-tickets ├── 983-minimum-cost-for-tickets.py ├── NOTES.md └── README.md ├── 987-vertical-order-traversal-of-a-binary-tree ├── 987-vertical-order-traversal-of-a-binary-tree.py ├── NOTES.md └── README.md ├── 99-recover-binary-search-tree ├── 99-recover-binary-search-tree.py └── README.md ├── 993-cousins-in-binary-tree ├── 993-cousins-in-binary-tree.py ├── NOTES.md └── README.md ├── 994-rotting-oranges ├── 994-rotting-oranges.py ├── NOTES.md └── README.md ├── 997-find-the-town-judge ├── 997-find-the-town-judge.py ├── NOTES.md └── README.md ├── 997_Find_The_Town_Judge.py ├── Basic └── Sieve of Eratosthenes │ ├── README.md │ └── sieve-of-eratosthenes.py ├── Basics-of-Python ├── .gitignore ├── 01.py ├── 01_Linkedlist.py ├── 02.py ├── 02_handling_different_exceptions.py ├── 03 travarse linked list.py ├── 03_join.py ├── 03_raising_exceptions.py ├── 04_print memory location.py ├── 05.py ├── 05_map.py ├── 06_Adding Elements At The Beginning Of The Linked List.py ├── 06_filter.py ├── 07_Adding Elements At The End Of The Linked List.py ├── 07_reduce.py ├── 08.py ├── 09.py ├── 10_add_after.py ├── 11 Adding Elements Before The Given Node in The Linked List .py ├── 12_add_empty.py ├── 13_ Delete At the Beginning.py ├── 14_Delete At the End.py ├── 15_Delete Any Node By Value in Linked List.py ├── 2D Matrix Important NOTE.py ├── BISECT Module - Binary Search.py ├── BST │ ├── 01.py │ ├── 02.py │ └── Roman Number to integer conversion.py ├── Chapter1.py │ ├── 01_dictionary_syntax.py │ ├── 02_dictionary_methods.py │ ├── 04_print_list_for.py │ ├── 05_range_function.py │ ├── 06_for_with_else.py │ ├── 06_pr_01 (copy).py │ ├── 06_pr_01.py │ ├── 07_break_statement.py │ ├── 07_pr_02 (copy).py │ ├── 07_pr_02.py │ ├── 08_pr_03.py │ ├── 09_other_dunder_methods.py │ ├── 09_pass_statement.py │ ├── 09_pr_05.py │ ├── 10_pr_06.py │ ├── Appoen. letter by user input │ ├── Armstrong Number │ ├── Check Prime Number │ ├── Class Attributes │ ├── Dictionary Methods │ ├── Divisibility of a number and it's property │ ├── Fibonacci sequence │ ├── Find the Largest Among Three Numbers (copy) │ ├── For loop with else (copy) │ ├── If else and elif in Python (copy) │ ├── If, elif, else. (copy) │ ├── LexycoGrafic Operators Order (copy) │ ├── Py Practice │ ├── Table of 5 (copy) │ ├── The break statement (copy) │ ├── The continue statement (copy) │ ├── To take values from the User (3rd copy) │ ├── To take values from the User (4th copy) │ ├── To take values from the User (5th copy) │ ├── To take values from the User (6th copy) │ ├── To take values from the User (7th copy) │ ├── To take values from the User (another copy) │ ├── To take values from the User (copy) │ ├── Twinkle, twinkle, little star (3rd copy) │ ├── Twinkle, twinkle, little star (4th copy) │ ├── Twinkle, twinkle, little star (5th copy) │ ├── Twinkle, twinkle, little star (6th copy) │ ├── Twinkle, twinkle, little star (another copy) │ ├── Twinkle, twinkle, little star (copy) │ ├── __init__() constructor (copy) │ ├── converting one data type to another data-type │ ├── cote to specify strings │ ├── def sheldon_knock() │ ├── elif clause │ ├── to Display the multiplication Table (3rd copy) │ ├── to Display the multiplication Table (another copy) │ └── to Display the multiplication Table (copy) ├── Chapter2.py │ ├── 001Conditional_statement_in_python.py │ ├── 01_import _os.listdir.py │ ├── 02.py │ ├── Celcious to ferenhite.py │ ├── Check if String Contains Substring.py │ ├── Check-a-number-prime-or-not-by-for-loop.py │ ├── Conditional_Stetment_and_Relational_Stetmente.py │ ├── Conditional_statement_in_python.py │ ├── Factorial of a number by for loop.py │ ├── Function.py │ ├── Identifing a spam commet from many words.py │ ├── Identifing a spam commet from many words02.py │ ├── Length_of_a_Password.py │ ├── Marks_to_Grads_conversion.py │ ├── Maximum_of_4numbers_with_For_Loop.py │ ├── Maximum_of_4numbers_with_If-Else.py │ ├── Minimum_of_an_array_With_For_Loop.py │ ├── Multiplication table in reverse order.py │ ├── Multiplication_table_of_a_number.py │ ├── Pass_Fail_By_Comparison.py │ ├── Revision_Python_previous_4_Hours.py │ ├── Sample.txt │ ├── Snake_water_Gun_Game.py │ ├── Sum of first n natual number using for loop.py │ ├── While_loop.py │ ├── a Rectangle with stars.py │ ├── def_max.py │ ├── else_optional.py │ ├── ends_function.py │ ├── files.py │ ├── in_Keyword.py │ ├── inch to cm.py │ ├── is_Keyword.py │ ├── modi.py │ ├── name-greetings-by-for-loop-and-if-else.py │ ├── pattern.py │ └── strip.py ├── DSA-problems │ ├── .vscode │ │ └── settings.json │ └── 01.py ├── Data_Stracture_Algorithms │ ├── 01.py │ └── 02.py ├── Find the Largest Among Three Numbers.py ├── For loop with else.py ├── Git_Push_Commands.py ├── If elif else.py ├── If else and elif in Python.py ├── Inheritance │ └── Polygon.py ├── Inheritence+Module │ ├── 02.py │ ├── Polygon.py │ ├── dir │ │ └── myfunction.py │ ├── main.py │ ├── rectangle.py │ ├── shape.py │ └── triangle.py ├── LexycoGrafic Operators Order.py ├── LinkedList │ ├── Doubly Linked List │ │ ├── 01_Traversing Operation.py │ │ ├── 02.py │ │ ├── 03_.PY │ │ ├── 04.py │ │ ├── 05.py │ │ ├── Circular Linked List .py │ │ ├── Reverse a Singly Linked List.py │ │ └── Total Double Linked List in one.py │ ├── Find nth last Node from the end of a Singly Linkedlist.py │ ├── Singly Linked List ALL-IN-ONE.py │ └── Singly Linked List │ │ ├── 01_Linkedlist.py │ │ ├── 02.py │ │ ├── 03 travarse linked list.py │ │ ├── 04_print memory location.py │ │ ├── 05.py │ │ ├── 06_Adding Elements At The Beginning Of The Linked List.py │ │ ├── 07_Adding Elements At The End Of The Linked List.py │ │ ├── 08.py │ │ ├── 09.py │ │ ├── 10_add_after.py │ │ ├── 11 Adding Elements Before The Given Node in The Linked List .py │ │ ├── 12_add_empty.py │ │ ├── 13_ Delete At the Beginning.py │ │ ├── 14_Delete At the End.py │ │ ├── 15_Delete Any Node By Value in Linked List.py │ │ ├── 16_Doubly Linked List.py │ │ └── add_end add_begin after_node print_LL.py ├── Modules │ ├── 01.py │ ├── 02.py │ ├── Aggregation.py │ ├── Class_COMPOSITION.py │ ├── Polygon.py │ ├── composition.py │ ├── dir │ │ └── myfunction.py │ ├── main.py │ ├── rectangle.py │ ├── shape.py │ ├── super_method.py │ └── triangle.py ├── My First Python Code.py ├── Object_Oriented_Programming │ ├── 01.py │ ├── 02.py │ ├── 03.py │ ├── 04.py │ ├── 05.py │ ├── 06.py │ ├── 07.py │ ├── 08.py │ ├── 09_get_set.py │ ├── 10_get_set.py │ ├── 11_privat_public.py │ ├── 12.py │ ├── 13.py │ ├── 14.py │ ├── 15.py │ ├── 16.py │ ├── 17.py │ ├── 18.py │ ├── 19.py │ ├── 2-D array.py │ ├── 20.py │ └── Abstract_Class.py ├── Operatos and expressions.py ├── Practice │ ├── 01.py │ ├── 01_conditionals.py │ ├── 01_virtualenv.py │ ├── 02.py │ ├── 02_if_else_quick_quiz.py │ ├── 02_single_inheritance.py │ ├── 03.py │ ├── 03_game_example.py │ ├── 03_logical_and_relational_operators.py │ ├── 03_multiple_inheritance.py │ ├── 04.py │ ├── 04_employee.py │ ├── 04_in_and_is.py │ ├── 04_multilevel_inheritance.py │ ├── 04_print_list_for.py │ ├── 04_try_with_else.py │ ├── 05.py │ ├── 05_instance_class_attributes (copy).py │ ├── 05_instance_class_attributes.py │ ├── 05_is_else_optional.py │ ├── 05_try_except_finally (copy).py │ ├── 05_try_except_finally.py │ ├── 06_pr_01 (copy).py │ ├── 06_pr_01.py │ ├── 06_self.py │ ├── 06_tuples.py │ ├── 07_pr_02.py │ ├── 07_property_decorator.py │ ├── 07_store_fruits.py │ ├── 08_Student_Marks.py │ ├── 08_continue_statement.py │ ├── 08_global.py │ ├── 08_pr_03.py │ ├── 09_05_pr_01.py │ ├── 09_06_game_pr_02.py │ ├── 09_07_pr_03.py │ ├── 09_08_pr_04.py │ ├── 09_09_pr_05.py │ ├── 09_enumerate.py │ ├── 09_pr_05.py │ ├── 09_sum_of_list.py │ ├── 10_ printing pyramid patterns in Python.py │ ├── 10_pr_04.py │ ├── 11_dictionary problem.py │ ├── 12_dictionary_methods.py │ ├── 13.py │ ├── 14.py │ ├── 15_check prime no.py │ ├── 16_Indentation_rule.py │ ├── 17_Divisibility of number.py │ ├── 18_use of Strip_Function.py │ ├── 19.py │ ├── 20_Sets_.py │ ├── 21.py │ ├── 22properties of sets.py │ ├── 23.py │ ├── 24Dictionary of Hindi to English.py │ ├── 25_instance_.py │ ├── 26.py │ ├── 27.py │ ├── 28.py │ ├── 29.py │ ├── 30A Dictionary to print Favourite Languages .py │ ├── 31Dictionary to print Favourite Languages When two name same.py │ ├── 32.py │ ├── 33.py │ ├── 34.py │ ├── Data-Stractures │ │ ├── 01_Linkedlist.py │ │ ├── 02.py │ │ ├── 03 travarse linked list.py │ │ ├── 04_print memory location.py │ │ ├── 05.py │ │ ├── 06_Adding Elements At The Beginning Of The Linked List.py │ │ ├── 07_Adding Elements At The End Of The Linked List.py │ │ ├── 08.py │ │ ├── 09.py │ │ ├── 10_add_after.py │ │ ├── 11 Adding Elements Before The Given Node in The Linked List .py │ │ ├── 12_add_empty.py │ │ ├── 13_ Delete At the Beginning.py │ │ ├── 14_Delete At the End.py │ │ ├── 15_Delete Any Node By Value in Linked List.py │ │ └── add_end add_begin after_node print_LL.py │ └── QUEUE.py ├── Print all Prime Numbers in an Interval.py ├── Python Program to Check Leap Year.py ├── Python lists.py ├── Queue Data-Stracture │ ├── 02.py │ ├── 03.py │ ├── 04.py │ ├── 05.py │ ├── 06.py │ ├── 07.py │ ├── QUEUE.py │ └── Trick to reverse a string in python.py ├── README.md ├── Recursion.py ├── Roman Number conversion.py ├── Stack │ ├── 01.py │ ├── 02.py │ ├── 03.py │ └── 04.py ├── Static method.py ├── String Fungtions.py ├── Syntax.py ├── Table of 5.py ├── The break statement.py ├── The continue statement.py ├── To Display the multiplication Table.py ├── To take values from the User.py ├── Trick to reverse a string in python.py ├── Twinkle twinkle little star.py ├── While and For loop in Java.py ├── Write a function in python that can reverse a string using stack data structure.py ├── Write a function in python that checks if paranthesis in the string are balanced or not. Possible parantheses are .py ├── __init__ constructor.py ├── _config.yml ├── add_end add_begin after_node print_LL.py ├── chapter3 .py │ ├── 01.py │ ├── Highscore.txt │ ├── New_File.txt │ ├── append.py │ ├── comment.txt │ ├── detecting line of a word.py │ ├── file reading.py │ ├── file_IO.py │ ├── game.py │ ├── log.txt │ ├── multiplication table 2 to 20 in different files by for loop │ │ ├── ZIP_1.png │ │ ├── multiplication table 2 to 20 in different files by for loop.py │ │ └── python.gif │ ├── poem.txt │ ├── rewrite_bad_words_from_a_file.py │ ├── samir.py │ ├── sample.txt │ ├── table_of_1.txt │ ├── table_of_10.txt │ ├── table_of_11.txt │ ├── table_of_12.txt │ ├── table_of_13.txt │ ├── table_of_14.txt │ ├── table_of_15.txt │ ├── table_of_16.txt │ ├── table_of_17.txt │ ├── table_of_18.txt │ ├── table_of_19.txt │ ├── table_of_2.txt │ ├── table_of_20.txt │ ├── table_of_3.txt │ ├── table_of_4.txt │ ├── table_of_5.txt │ ├── table_of_6.txt │ ├── table_of_7.txt │ ├── table_of_8.txt │ ├── table_of_9.txt │ ├── text.txt │ ├── this.py │ ├── this.txt │ ├── with statement.py │ ├── word.py │ └── write a file.py └── instance variable and class variable.py ├── BingSiteAuth.xml ├── Bottom View of Binary Tree - GFG ├── README.md └── bottom-view-of-binary-tree.py ├── Children Sum Parent - GFG ├── README.md └── children-sum-parent.py ├── Column name from a given column number - GFG ├── README.md └── column-name-from-a-given-column-number.py ├── Consecutive 1's not allowed - GFG ├── README.md └── consecutive-1s-not-allowed.py ├── Diameter of a Binary Tree - GFG ├── README.md └── diameter-of-a-binary-tree.py ├── Easy ├── Children Sum Parent │ ├── README.md │ └── children-sum-parent.py ├── Evaluation of Postfix Expression │ ├── README.md │ └── evaluation-of-postfix-expression.py ├── Find Nth root of M │ ├── README.md │ └── find-nth-root-of-m.py ├── Kth largest element in BST │ ├── README.md │ └── kth-largest-element-in-bst.py ├── Largest subarray with 0 sum │ ├── README.md │ └── largest-subarray-with-0-sum.py ├── Left View of Binary Tree │ ├── README.md │ └── left-view-of-binary-tree.py ├── Mirror Tree │ ├── README.md │ └── mirror-tree.py ├── N meetings in one room │ ├── README.md │ └── n-meetings-in-one-room.py ├── Sort a stack │ ├── README.md │ └── sort-a-stack.py └── Subarray range with given sum │ ├── README.md │ └── subarray-range-with-given-sum.py ├── Flattening a Linked List - GFG ├── README.md └── flattening-a-linked-list.py ├── Gemfile ├── Gold Mine Problem - GFG ├── README.md └── gold-mine-problem.py ├── Google.html ├── Hard ├── Allocate minimum number of pages │ ├── README.md │ └── allocate-minimum-number-of-pages.py └── The Painter's Partition Problem-II │ ├── README.md │ └── the-painters-partition-problem-ii.py ├── Job Sequencing Problem - GFG └── README.md ├── Largest BST - GFG ├── README.md └── largest-bst.py ├── Leaves to DLL - GFG ├── README.md └── leaves-to-dll.py ├── Left View of Binary Tree - GFG ├── README.md └── left-view-of-binary-tree.py ├── Maximize XOR - GFG ├── README.md └── maximize-xor.py ├── Maximum path sum in matrix - GFG ├── README.md └── maximum-path-sum-in-matrix.py ├── Maximum sum Rectangle - GFG ├── README.md └── maximum-sum-rectangle.py ├── Maximum sum increasing subsequence - GFG ├── README.md └── maximum-sum-increasing-subsequence.py ├── Medium ├── Bottom View of Binary Tree │ ├── README.md │ └── bottom-view-of-binary-tree.py ├── Boundary Traversal of binary tree │ ├── README.md │ └── boundary-traversal-of-binary-tree.py ├── Egg Dropping Puzzle │ ├── README.md │ └── egg-dropping-puzzle.py ├── Flattening a Linked List │ ├── README.md │ └── flattening-a-linked-list.py ├── Infix to Postfix │ ├── README.md │ └── infix-to-postfix.py ├── Majority Element │ ├── README.md │ └── majority-element.py ├── Maximum sum increasing subsequence │ ├── README.md │ └── maximum-sum-increasing-subsequence.py ├── Minimum Platforms │ ├── README.md │ └── minimum-platforms.py ├── Negative weight cycle │ ├── README.md │ └── negative-weight-cycle.py ├── Rat in a Maze Problem - I │ └── README.md ├── Subset Sums │ ├── README.md │ └── subset-sums.py ├── Top View of Binary Tree │ └── README.md ├── Tower Of Hanoi │ ├── README.md │ └── tower-of-hanoi.py └── Trapping Rain Water │ ├── README.md │ └── trapping-rain-water.py ├── Minimum Platforms - GFG ├── README.md └── minimum-platforms.py ├── Minimum distance between two numbers - GFG ├── README.md └── minimum-distance-between-two-numbers.py ├── Mirror Tree - GFG ├── README.md └── mirror-tree.py ├── Move all zeroes to end of array - GFG ├── README.md └── move-all-zeroes-to-end-of-array.py ├── N meetings in one room - GFG ├── README.md └── n-meetings-in-one-room.py ├── Negative weight cycle - GFG ├── README.md └── negative-weight-cycle.py ├── Power Set - GFG ├── README.md └── power-set.py ├── School └── GCD of two numbers │ └── README.md ├── Serialize and Deserialize a Binary Tree - GFG ├── README.md └── serialize-and-deserialize-a-binary-tree.py ├── Top View of Binary Tree - GFG ├── README.md └── top-view-of-binary-tree.py ├── __init__.py ├── _config.yml ├── _layouts └── default.html ├── ads.txt ├── assets └── long-banner-breck-img-readme-unnamed.png ├── index.html ├── leetcode-cpp ├── 01-matrix │ ├── 01-matrix.cpp │ └── README.md ├── 1048-longest-string-chain │ ├── 1048-longest-string-chain.cpp │ ├── NOTES.md │ └── README.md ├── 1146-snapshot-array │ ├── 1146-snapshot-array.cpp │ └── NOTES.md ├── 121-best-time-to-buy-and-sell-stock │ ├── 121-best-time-to-buy-and-sell-stock.cpp │ ├── NOTES.md │ └── README.md ├── 1219-path-with-maximum-gold │ ├── 1219-path-with-maximum-gold.cpp │ ├── NOTES.md │ └── README.md ├── 1291-sequential-digits │ ├── 1291-sequential-digits.cpp │ ├── NOTES.md │ └── README.md ├── 1297-maximum-number-of-occurrences-of-a-substring │ ├── 1297-maximum-number-of-occurrences-of-a-substring.cpp │ ├── NOTES.md │ └── README.md ├── 1305-all-elements-in-two-binary-search-trees │ ├── 1305-all-elements-in-two-binary-search-trees.cpp │ └── NOTES.md ├── 132-pattern │ ├── 132-pattern.cpp │ └── README.md ├── 1367-linked-list-in-binary-tree │ ├── 1367-linked-list-in-binary-tree.cpp │ ├── NOTES.md │ └── README.md ├── 1371-find-the-longest-substring-containing-vowels-in-even-counts │ ├── 1371-find-the-longest-substring-containing-vowels-in-even-counts.cpp │ ├── NOTES.md │ └── README.md ├── 1672-richest-customer-wealth │ ├── 1672-richest-customer-wealth.cpp │ ├── NOTES.md │ └── README.md ├── 2-keys-keyboard │ ├── 2-keys-keyboard.cpp │ └── README.md ├── 3sum │ ├── 3sum.cpp │ └── README.md ├── 438-find-all-anagrams-in-a-string │ ├── 438-find-all-anagrams-in-a-string.cpp │ ├── NOTES.md │ └── README.md ├── 454-4sum-ii │ ├── 454-4sum-ii.cpp │ ├── NOTES.md │ └── README.md ├── 486-predict-the-winner │ ├── 486-predict-the-winner.cpp │ ├── NOTES.md │ └── README.md ├── 4sum-ii │ ├── 4sum-ii.cpp │ └── README.md ├── 4sum │ ├── 4sum.cpp │ └── README.md ├── 638-shopping-offers │ ├── 638-shopping-offers.cpp │ ├── NOTES.md │ └── README.md ├── 684-redundant-connection │ ├── 684-redundant-connection.cpp │ ├── NOTES.md │ └── README.md ├── 834-sum-of-distances-in-tree │ ├── 834-sum-of-distances-in-tree.cpp │ ├── NOTES.md │ └── README.md ├── 849-maximize-distance-to-closest-person │ ├── 849-maximize-distance-to-closest-person.cpp │ ├── NOTES.md │ └── README.md ├── Bitmask.cpp ├── README.md ├── accounts-merge │ ├── README.md │ └── accounts-merge.cpp ├── add-two-numbers-ii │ └── README.md ├── add-two-numbers │ └── README.md ├── advantage-shuffle │ ├── README.md │ └── advantage-shuffle.cpp ├── all-nodes-distance-k-in-binary-tree │ ├── README.md │ └── all-nodes-distance-k-in-binary-tree.cpp ├── all-possible-full-binary-trees │ ├── README.md │ └── all-possible-full-binary-trees.cpp ├── arranging-coins │ ├── README.md │ └── arranging-coins.cpp ├── as-far-from-land-as-possible │ ├── README.md │ └── as-far-from-land-as-possible.cpp ├── assign-cookies │ ├── README.md │ └── assign-cookies.cpp ├── asteroid-collision │ ├── README.md │ └── asteroid-collision.cpp ├── average-of-levels-in-binary-tree │ ├── README.md │ └── average-of-levels-in-binary-tree.cpp ├── backspace-string-compare │ ├── README.md │ └── backspace-string-compare.cpp ├── balanced-binary-tree │ ├── README.md │ └── balanced-binary-tree.cpp ├── beautiful-arrangement-ii │ ├── README.md │ └── beautiful-arrangement-ii.cpp ├── beautiful-array │ ├── README.md │ └── beautiful-array.cpp ├── best-time-to-buy-and-sell-stock-iii │ ├── README.md │ └── best-time-to-buy-and-sell-stock-iii.cpp ├── best-time-to-buy-and-sell-stock-iv │ ├── README.md │ └── best-time-to-buy-and-sell-stock-iv.cpp ├── best-time-to-buy-and-sell-stock-with-cooldown │ ├── README.md │ └── best-time-to-buy-and-sell-stock-with-cooldown.cpp ├── best-time-to-buy-and-sell-stock │ ├── README.md │ └── best-time-to-buy-and-sell-stock.cpp ├── binary-search-tree-iterator │ ├── README.md │ └── binary-search-tree-iterator.cpp ├── binary-search-tree-to-greater-sum-tree │ ├── README.md │ └── binary-search-tree-to-greater-sum-tree.cpp ├── binary-search │ ├── README.md │ └── binary-search.cpp ├── binary-subarrays-with-sum │ ├── README.md │ └── binary-subarrays-with-sum.cpp ├── binary-tree-cameras │ ├── README.md │ └── binary-tree-cameras.cpp ├── binary-tree-inorder-traversal │ ├── README.md │ └── binary-tree-inorder-traversal.cpp ├── binary-tree-level-order-traversal-ii │ ├── README.md │ └── binary-tree-level-order-traversal-ii.cpp ├── binary-tree-maximum-path-sum │ ├── README.md │ └── binary-tree-maximum-path-sum.cpp ├── binary-tree-paths │ ├── README.md │ └── binary-tree-paths.cpp ├── binary-tree-postorder-traversal │ ├── README.md │ └── binary-tree-postorder-traversal.cpp ├── binary-tree-preorder-traversal │ ├── README.md │ └── binary-tree-preorder-traversal.cpp ├── binary-tree-pruning │ ├── README.md │ └── binary-tree-pruning.cpp ├── bitwise-and-of-numbers-range │ ├── README.md │ └── bitwise-and-of-numbers-range.cpp ├── boats-to-save-people │ ├── README.md │ └── boats-to-save-people.cpp ├── burst-balloons │ ├── README.md │ └── burst-balloons.cpp ├── camelcase-matching │ ├── README.md │ └── camelcase-matching.cpp ├── candy │ ├── README.md │ └── candy.cpp ├── capacity-to-ship-packages-within-d-days │ ├── README.md │ └── capacity-to-ship-packages-within-d-days.cpp ├── car-pooling │ ├── README.md │ └── car-pooling.cpp ├── cat-and-mouse-ii │ ├── README.md │ └── cat-and-mouse-ii.cpp ├── cat-and-mouse │ ├── README.md │ └── cat-and-mouse.cpp ├── check-if-a-string-can-break-another-string │ ├── README.md │ └── check-if-a-string-can-break-another-string.cpp ├── check-if-binary-string-has-at-most-one-segment-of-ones │ ├── README.md │ └── check-if-binary-string-has-at-most-one-segment-of-ones.cpp ├── checking-existence-of-edge-length-limited-paths │ ├── README.md │ └── checking-existence-of-edge-length-limited-paths.cpp ├── cherry-pickup-ii │ ├── README.md │ └── cherry-pickup-ii.cpp ├── cherry-pickup │ ├── README.md │ └── cherry-pickup.cpp ├── cinema-seat-allocation │ ├── README.md │ └── cinema-seat-allocation.cpp ├── circular-array-loop │ ├── README.md │ └── circular-array-loop.cpp ├── climbing-stairs │ ├── README.md │ └── climbing-stairs.cpp ├── clone-graph │ ├── README.md │ └── clone-graph.cpp ├── coin-change │ ├── README.md │ └── coin-change.cpp ├── combination-sum-iii │ ├── README.md │ └── combination-sum-iii.cpp ├── combinations │ ├── README.md │ └── combinations.cpp ├── compare-version-numbers │ └── README.md ├── concatenated-words │ ├── README.md │ └── concatenated-words.cpp ├── construct-binary-search-tree-from-preorder-traversal │ ├── README.md │ └── construct-binary-search-tree-from-preorder-traversal.cpp ├── construct-binary-tree-from-inorder-and-postorder-traversal │ ├── README.md │ └── construct-binary-tree-from-inorder-and-postorder-traversal.cpp ├── construct-binary-tree-from-preorder-and-inorder-traversal │ ├── README.md │ └── construct-binary-tree-from-preorder-and-inorder-traversal.cpp ├── construct-k-palindrome-strings │ ├── README.md │ └── construct-k-palindrome-strings.cpp ├── construct-string-from-binary-tree │ ├── README.md │ └── construct-string-from-binary-tree.cpp ├── contiguous-array │ ├── README.md │ └── contiguous-array.cpp ├── continuous-subarray-sum │ ├── README.md │ └── continuous-subarray-sum.cpp ├── convert-bst-to-greater-tree │ ├── README.md │ └── convert-bst-to-greater-tree.cpp ├── convert-sorted-array-to-binary-search-tree │ ├── README.md │ └── convert-sorted-array-to-binary-search-tree.cpp ├── convert-sorted-list-to-binary-search-tree │ ├── README.md │ └── convert-sorted-list-to-binary-search-tree.cpp ├── copy-list-with-random-pointer │ ├── README.md │ └── copy-list-with-random-pointer.cpp ├── count-good-meals │ ├── README.md │ └── count-good-meals.cpp ├── count-good-nodes-in-binary-tree │ ├── README.md │ └── count-good-nodes-in-binary-tree.cpp ├── count-of-range-sum │ ├── README.md │ └── count-of-range-sum.cpp ├── count-of-smaller-numbers-after-self │ ├── README.md │ └── count-of-smaller-numbers-after-self.cpp ├── count-vowels-permutation │ ├── README.md │ └── count-vowels-permutation.cpp ├── counting-bits │ ├── README.md │ └── counting-bits.cpp ├── course-schedule-ii │ ├── README.md │ └── course-schedule-ii.cpp ├── course-schedule-iii │ ├── README.md │ └── course-schedule-iii.cpp ├── course-schedule-iv │ ├── README.md │ └── course-schedule-iv.cpp ├── course-schedule │ ├── README.md │ └── course-schedule.cpp ├── cousins-in-binary-tree │ ├── README.md │ └── cousins-in-binary-tree.cpp ├── custom-sort-string │ ├── README.md │ └── custom-sort-string.cpp ├── daily-temperatures │ ├── README.md │ └── daily-temperatures.cpp ├── decode-string │ ├── README.md │ └── decode-string.cpp ├── decode-xored-array │ ├── README.md │ └── decode-xored-array.cpp ├── decode-xored-permutation │ ├── README.md │ └── decode-xored-permutation.cpp ├── deepest-leaves-sum │ ├── README.md │ └── deepest-leaves-sum.cpp ├── delete-duplicate-emails │ ├── README.md │ └── delete-duplicate-emails.sql ├── delete-node-in-a-bst │ ├── README.md │ └── delete-node-in-a-bst.cpp ├── delete-node-in-a-linked-list │ ├── README.md │ └── delete-node-in-a-linked-list.cpp ├── delete-nodes-and-return-forest │ ├── README.md │ └── delete-nodes-and-return-forest.cpp ├── department-highest-salary │ ├── README.md │ └── department-highest-salary.sql ├── design-hashset │ ├── README.md │ └── design-hashset.cpp ├── diameter-of-binary-tree │ ├── README.md │ └── diameter-of-binary-tree.cpp ├── distinct-subsequences │ ├── README.md │ └── distinct-subsequences.cpp ├── distribute-coins-in-binary-tree │ ├── README.md │ └── distribute-coins-in-binary-tree.cpp ├── divide-array-in-sets-of-k-consecutive-numbers │ ├── README.md │ └── divide-array-in-sets-of-k-consecutive-numbers.cpp ├── domino-and-tromino-tiling │ ├── README.md │ └── domino-and-tromino-tiling.cpp ├── edit-distance │ ├── README.md │ └── edit-distance.cpp ├── employee-importance │ ├── README.md │ └── employee-importance.cpp ├── employees-earning-more-than-their-managers │ ├── README.md │ └── employees-earning-more-than-their-managers.sql ├── encode-and-decode-tinyurl │ ├── README.md │ └── encode-and-decode-tinyurl.cpp ├── equal-sum-arrays-with-minimum-number-of-operations │ ├── README.md │ └── equal-sum-arrays-with-minimum-number-of-operations.cpp ├── evaluate-division │ ├── README.md │ └── evaluate-division.cpp ├── find-all-anagrams-in-a-string │ ├── README.md │ └── find-all-anagrams-in-a-string.cpp ├── find-and-replace-pattern │ ├── README.md │ └── find-and-replace-pattern.cpp ├── find-bottom-left-tree-value │ ├── README.md │ └── find-bottom-left-tree-value.cpp ├── find-center-of-star-graph │ ├── README.md │ └── find-center-of-star-graph.cpp ├── find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree │ ├── README.md │ └── find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree.cpp ├── find-eventual-safe-states │ └── README.md ├── find-first-and-last-position-of-element-in-sorted-array │ ├── README.md │ └── find-first-and-last-position-of-element-in-sorted-array.cpp ├── find-k-closest-elements │ ├── README.md │ └── find-k-closest-elements.cpp ├── find-k-pairs-with-smallest-sums │ ├── README.md │ └── find-k-pairs-with-smallest-sums.cpp ├── find-median-from-data-stream │ ├── README.md │ └── find-median-from-data-stream.cpp ├── find-minimum-in-rotated-sorted-array │ ├── README.md │ └── find-minimum-in-rotated-sorted-array.cpp ├── find-n-unique-integers-sum-up-to-zero │ ├── README.md │ └── find-n-unique-integers-sum-up-to-zero.cpp ├── find-right-interval │ ├── README.md │ └── find-right-interval.cpp ├── find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance │ └── README.md ├── find-the-duplicate-number │ ├── README.md │ └── find-the-duplicate-number.cpp ├── find-the-smallest-divisor-given-a-threshold │ ├── README.md │ └── find-the-smallest-divisor-given-a-threshold.cpp ├── find-the-town-judge │ └── README.md ├── first-bad-version │ ├── README.md │ └── first-bad-version.cpp ├── first-missing-positive │ ├── README.md │ └── first-missing-positive.cpp ├── flatten-binary-tree-to-linked-list │ ├── README.md │ └── flatten-binary-tree-to-linked-list.cpp ├── flower-planting-with-no-adjacent │ ├── README.md │ └── flower-planting-with-no-adjacent.cpp ├── frog-jump │ ├── README.md │ └── frog-jump.cpp ├── fruit-into-baskets │ ├── README.md │ └── fruit-into-baskets.cpp ├── game-of-life │ ├── README.md │ └── game-of-life.cpp ├── gas-station │ ├── README.md │ └── gas-station.cpp ├── generate-parentheses │ ├── README.md │ └── generate-parentheses.cpp ├── group-the-people-given-the-group-size-they-belong-to │ ├── README.md │ └── group-the-people-given-the-group-size-they-belong-to.cpp ├── h-index-ii │ ├── README.md │ └── h-index-ii.cpp ├── h-index │ ├── README.md │ └── h-index.cpp ├── hand-of-straights │ ├── README.md │ └── hand-of-straights.cpp ├── heaters │ ├── README.md │ └── heaters.cpp ├── house-robber-ii │ ├── README.md │ └── house-robber-ii.cpp ├── house-robber-iii │ ├── README.md │ └── house-robber-iii.cpp ├── house-robber │ ├── README.md │ └── house-robber.cpp ├── implement-trie-prefix-tree │ ├── README.md │ └── implement-trie-prefix-tree.cpp ├── increasing-triplet-subsequence │ ├── README.md │ └── increasing-triplet-subsequence.cpp ├── insert-delete-getrandom-o1-duplicates-allowed │ ├── README.md │ └── insert-delete-getrandom-o1-duplicates-allowed.cpp ├── insert-delete-getrandom-o1 │ ├── README.md │ └── insert-delete-getrandom-o1.cpp ├── insertion-sort-list │ ├── README.md │ └── insertion-sort-list.cpp ├── intersection-of-two-linked-lists │ ├── README.md │ └── intersection-of-two-linked-lists.cpp ├── interval-list-intersections │ ├── README.md │ └── interval-list-intersections.cpp ├── invert-binary-tree │ ├── README.md │ └── invert-binary-tree.cpp ├── is-graph-bipartite │ ├── README.md │ └── is-graph-bipartite.cpp ├── island-perimeter │ └── README.md ├── jump-game-ii │ ├── README.md │ └── jump-game-ii.cpp ├── jump-game-iii │ ├── README.md │ └── jump-game-iii.cpp ├── jump-game-v │ ├── README.md │ └── jump-game-v.cpp ├── jump-game │ ├── README.md │ └── jump-game.cpp ├── k-closest-points-to-origin │ ├── README.md │ └── k-closest-points-to-origin.cpp ├── keys-and-rooms │ └── README.md ├── knight-probability-in-chessboard │ ├── README.md │ └── knight-probability-in-chessboard.cpp ├── koko-eating-bananas │ ├── README.md │ └── koko-eating-bananas.cpp ├── kth-smallest-element-in-a-sorted-matrix │ ├── README.md │ └── kth-smallest-element-in-a-sorted-matrix.cpp ├── largest-rectangle-in-histogram │ ├── README.md │ └── largest-rectangle-in-histogram.cpp ├── lemonade-change │ ├── README.md │ └── lemonade-change.cpp ├── letter-case-permutation │ ├── README.md │ └── letter-case-permutation.cpp ├── letter-combinations-of-a-phone-number │ ├── README.md │ └── letter-combinations-of-a-phone-number.cpp ├── linked-list-cycle │ ├── README.md │ └── linked-list-cycle.cpp ├── longest-common-prefix │ ├── README.md │ └── longest-common-prefix.cpp ├── longest-common-subsequence │ ├── README.md │ └── longest-common-subsequence.cpp ├── longest-consecutive-sequence │ ├── README.md │ └── longest-consecutive-sequence.cpp ├── longest-increasing-path-in-a-matrix │ ├── README.md │ └── longest-increasing-path-in-a-matrix.cpp ├── longest-increasing-subsequence │ ├── README.md │ └── longest-increasing-subsequence.cpp ├── longest-palindromic-subsequence │ ├── README.md │ └── longest-palindromic-subsequence.cpp ├── longest-palindromic-substring │ ├── README.md │ └── longest-palindromic-substring.cpp ├── longest-repeating-character-replacement │ ├── README.md │ └── longest-repeating-character-replacement.cpp ├── longest-substring-with-at-least-k-repeating-characters │ ├── README.md │ └── longest-substring-with-at-least-k-repeating-characters.cpp ├── longest-substring-without-repeating-characters │ ├── README.md │ └── longest-substring-without-repeating-characters.cpp ├── longest-valid-parentheses │ ├── README.md │ └── longest-valid-parentheses.cpp ├── loud-and-rich │ ├── README.md │ └── loud-and-rich.cpp ├── lowest-common-ancestor-of-a-binary-search-tree │ ├── README.md │ └── lowest-common-ancestor-of-a-binary-search-tree.cpp ├── lowest-common-ancestor-of-a-binary-tree │ ├── README.md │ └── lowest-common-ancestor-of-a-binary-tree.cpp ├── lru-cache │ ├── README.md │ └── lru-cache.cpp ├── majority-element-ii │ └── README.md ├── majority-element │ ├── README.md │ └── majority-element.cpp ├── making-a-large-island │ ├── README.md │ └── making-a-large-island.cpp ├── map-sum-pairs │ ├── README.md │ └── map-sum-pairs.cpp ├── max-consecutive-ones │ ├── README.md │ └── max-consecutive-ones.cpp ├── maximize-distance-to-closest-person │ ├── README.md │ └── maximize-distance-to-closest-person.cpp ├── maximum-binary-tree │ ├── README.md │ └── maximum-binary-tree.cpp ├── maximum-depth-of-binary-tree │ ├── README.md │ └── maximum-depth-of-binary-tree.cpp ├── maximum-erasure-value │ ├── README.md │ └── maximum-erasure-value.cpp ├── maximum-gap │ ├── README.md │ └── maximum-gap.cpp ├── maximum-product-subarray │ ├── README.md │ └── maximum-product-subarray.cpp ├── maximum-score-from-removing-substrings │ ├── README.md │ └── maximum-score-from-removing-substrings.cpp ├── maximum-subarray │ ├── README.md │ └── maximum-subarray.cpp ├── maximum-sum-bst-in-binary-tree │ ├── README.md │ └── maximum-sum-bst-in-binary-tree.cpp ├── maximum-sum-circular-subarray │ ├── README.md │ └── maximum-sum-circular-subarray.cpp ├── maximum-width-of-binary-tree │ ├── README.md │ └── maximum-width-of-binary-tree.cpp ├── maximum-xor-of-two-numbers-in-an-array │ ├── README.md │ └── maximum-xor-of-two-numbers-in-an-array.cpp ├── maximum-xor-with-an-element-from-array │ ├── README.md │ └── maximum-xor-with-an-element-from-array.cpp ├── median-of-two-sorted-arrays │ ├── README.md │ └── median-of-two-sorted-arrays.cpp ├── merge-intervals │ ├── README.md │ └── merge-intervals.cpp ├── merge-k-sorted-lists │ ├── README.md │ └── merge-k-sorted-lists.cpp ├── merge-sorted-array │ ├── README.md │ └── merge-sorted-array.cpp ├── merge-two-sorted-lists │ ├── README.md │ └── merge-two-sorted-lists.cpp ├── middle-of-the-linked-list │ ├── README.md │ └── middle-of-the-linked-list.cpp ├── min-stack │ ├── README.md │ └── min-stack.cpp ├── minesweeper │ ├── README.md │ └── minesweeper.cpp ├── minimum-absolute-sum-difference │ ├── README.md │ └── minimum-absolute-sum-difference.cpp ├── minimum-add-to-make-parentheses-valid │ ├── README.md │ └── minimum-add-to-make-parentheses-valid.cpp ├── minimum-ascii-delete-sum-for-two-strings │ ├── README.md │ └── minimum-ascii-delete-sum-for-two-strings.cpp ├── minimum-cost-to-make-at-least-one-valid-path-in-a-grid │ ├── README.md │ └── minimum-cost-to-make-at-least-one-valid-path-in-a-grid.cpp ├── minimum-cost-to-move-chips-to-the-same-position │ ├── README.md │ └── minimum-cost-to-move-chips-to-the-same-position.cpp ├── minimum-depth-of-binary-tree │ ├── README.md │ └── minimum-depth-of-binary-tree.cpp ├── minimum-flips-to-make-a-or-b-equal-to-c │ ├── README.md │ └── minimum-flips-to-make-a-or-b-equal-to-c.cpp ├── minimum-height-trees │ ├── README.md │ └── minimum-height-trees.cpp ├── minimum-limit-of-balls-in-a-bag │ ├── README.md │ └── minimum-limit-of-balls-in-a-bag.cpp ├── minimum-number-of-days-to-make-m-bouquets │ ├── README.md │ └── minimum-number-of-days-to-make-m-bouquets.cpp ├── minimum-number-of-k-consecutive-bit-flips │ ├── README.md │ └── minimum-number-of-k-consecutive-bit-flips.cpp ├── minimum-operations-to-reduce-x-to-zero │ ├── README.md │ └── minimum-operations-to-reduce-x-to-zero.cpp ├── minimum-path-sum │ ├── README.md │ └── minimum-path-sum.cpp ├── minimum-remove-to-make-valid-parentheses │ ├── README.md │ └── minimum-remove-to-make-valid-parentheses.cpp ├── minimum-size-subarray-sum │ ├── README.md │ └── minimum-size-subarray-sum.cpp ├── minimum-swaps-to-make-sequences-increasing │ ├── README.md │ └── minimum-swaps-to-make-sequences-increasing.cpp ├── minimum-window-substring │ ├── README.md │ └── minimum-window-substring.cpp ├── most-stones-removed-with-same-row-or-column │ └── README.md ├── multiply-strings │ ├── README.md │ └── multiply-strings.cpp ├── n-ary-tree-level-order-traversal │ ├── README.md │ └── n-ary-tree-level-order-traversal.cpp ├── n-ary-tree-preorder-traversal │ ├── README.md │ └── n-ary-tree-preorder-traversal.cpp ├── n-queens │ ├── README.md │ └── n-queens.cpp ├── network-delay-time │ ├── README.md │ └── network-delay-time.cpp ├── next-greater-element-ii │ ├── README.md │ └── next-greater-element-ii.cpp ├── next-permutation │ ├── README.md │ └── next-permutation.cpp ├── non-overlapping-intervals │ ├── README.md │ └── non-overlapping-intervals.cpp ├── nth-highest-salary │ └── README.md ├── number-of-1-bits │ ├── README.md │ └── number-of-1-bits.cpp ├── number-of-burgers-with-no-waste-of-ingredients │ ├── README.md │ └── number-of-burgers-with-no-waste-of-ingredients.cpp ├── number-of-closed-islands │ ├── README.md │ └── number-of-closed-islands.cpp ├── number-of-dice-rolls-with-target-sum │ ├── README.md │ └── number-of-dice-rolls-with-target-sum.cpp ├── number-of-enclaves │ └── number-of-enclaves.cpp ├── number-of-islands │ ├── README.md │ └── number-of-islands.cpp ├── number-of-longest-increasing-subsequence │ ├── README.md │ └── number-of-longest-increasing-subsequence.cpp ├── number-of-matching-subsequences │ ├── README.md │ └── number-of-matching-subsequences.cpp ├── number-of-operations-to-make-network-connected │ ├── README.md │ └── number-of-operations-to-make-network-connected.cpp ├── number-of-provinces │ ├── README.md │ └── number-of-provinces.cpp ├── number-of-steps-to-reduce-a-number-to-zero │ ├── README.md │ └── number-of-steps-to-reduce-a-number-to-zero.cpp ├── number-of-ways-to-stay-in-the-same-place-after-some-steps │ ├── README.md │ └── number-of-ways-to-stay-in-the-same-place-after-some-steps.cpp ├── odd-even-linked-list │ ├── README.md │ └── odd-even-linked-list.cpp ├── out-of-boundary-paths │ ├── README.md │ └── out-of-boundary-paths.cpp ├── pacific-atlantic-water-flow │ ├── README.md │ └── pacific-atlantic-water-flow.cpp ├── palindrome-linked-list │ ├── README.md │ └── palindrome-linked-list.cpp ├── palindrome-partitioning-ii │ ├── README.md │ └── palindrome-partitioning-ii.cpp ├── palindrome-partitioning │ ├── README.md │ └── palindrome-partitioning.cpp ├── palindromic-substrings │ ├── README.md │ └── palindromic-substrings.cpp ├── partition-equal-subset-sum │ └── README.md ├── partition-labels │ ├── README.md │ └── partition-labels.cpp ├── partition-to-k-equal-sum-subsets │ ├── README.md │ └── partition-to-k-equal-sum-subsets.cpp ├── pascals-triangle-ii │ ├── README.md │ └── pascals-triangle-ii.cpp ├── pascals-triangle │ ├── README.md │ └── pascals-triangle.cpp ├── path-in-zigzag-labelled-binary-tree │ ├── README.md │ └── path-in-zigzag-labelled-binary-tree.cpp ├── path-sum-ii │ ├── README.md │ └── path-sum-ii.cpp ├── path-sum-iii │ ├── README.md │ └── path-sum-iii.cpp ├── path-sum │ ├── README.md │ └── path-sum.cpp ├── perfect-squares │ ├── README.md │ └── perfect-squares.cpp ├── permutation-in-string │ ├── README.md │ └── permutation-in-string.cpp ├── permutations-ii │ ├── README.md │ └── permutations-ii.cpp ├── permutations │ ├── README.md │ └── permutations.cpp ├── plates-between-candles │ ├── README.md │ └── plates-between-candles.cpp ├── populating-next-right-pointers-in-each-node-ii │ ├── README.md │ └── populating-next-right-pointers-in-each-node-ii.cpp ├── populating-next-right-pointers-in-each-node │ ├── README.md │ └── populating-next-right-pointers-in-each-node.cpp ├── possible-bipartition │ ├── README.md │ └── possible-bipartition.cpp ├── power-of-four │ ├── README.md │ └── power-of-four.cpp ├── power-of-three │ ├── README.md │ └── power-of-three.cpp ├── power-of-two │ ├── README.md │ └── power-of-two.cpp ├── powx-n │ ├── README.md │ └── powx-n.cpp ├── previous-permutation-with-one-swap │ ├── README.md │ └── previous-permutation-with-one-swap.cpp ├── queries-on-a-permutation-with-key │ ├── README.md │ └── queries-on-a-permutation-with-key.cpp ├── queue-reconstruction-by-height │ ├── README.md │ └── queue-reconstruction-by-height.cpp ├── rabbits-in-forest │ ├── README.md │ └── rabbits-in-forest.cpp ├── range-sum-query-mutable │ ├── README.md │ └── range-sum-query-mutable.cpp ├── reach-a-number │ ├── README.md │ └── reach-a-number.cpp ├── reconstruct-itinerary │ ├── README.md │ └── reconstruct-itinerary.cpp ├── reduce-array-size-to-the-half │ ├── README.md │ └── reduce-array-size-to-the-half.cpp ├── redundant-connection │ ├── README.md │ └── redundant-connection.cpp ├── regions-cut-by-slashes │ ├── README.md │ └── regions-cut-by-slashes.cpp ├── regular-expression-matching │ ├── README.md │ └── regular-expression-matching.cpp ├── remove-all-adjacent-duplicates-in-string-ii │ ├── README.md │ └── remove-all-adjacent-duplicates-in-string-ii.cpp ├── remove-all-adjacent-duplicates-in-string │ ├── README.md │ └── remove-all-adjacent-duplicates-in-string.cpp ├── remove-invalid-parentheses │ ├── README.md │ └── remove-invalid-parentheses.cpp ├── remove-k-digits │ ├── README.md │ └── remove-k-digits.cpp ├── remove-nth-node-from-end-of-list │ ├── README.md │ └── remove-nth-node-from-end-of-list.cpp ├── remove-sub-folders-from-the-filesystem │ ├── README.md │ └── remove-sub-folders-from-the-filesystem.cpp ├── reorder-list │ ├── README.md │ └── reorder-list.cpp ├── reordered-power-of-2 │ └── README.md ├── reorganize-string │ ├── README.md │ └── reorganize-string.cpp ├── reverse-bits │ ├── README.md │ └── reverse-bits.cpp ├── reverse-linked-list-ii │ ├── README.md │ └── reverse-linked-list-ii.cpp ├── reverse-linked-list │ ├── README.md │ └── reverse-linked-list.cpp ├── reverse-nodes-in-k-group │ ├── README.md │ └── reverse-nodes-in-k-group.cpp ├── reverse-pairs │ ├── README.md │ └── reverse-pairs.cpp ├── reverse-substrings-between-each-pair-of-parentheses │ ├── README.md │ └── reverse-substrings-between-each-pair-of-parentheses.cpp ├── robot-bounded-in-circle │ ├── README.md │ └── robot-bounded-in-circle.cpp ├── rotate-image │ ├── README.md │ └── rotate-image.cpp ├── rotate-list │ ├── README.md │ └── rotate-list.cpp ├── rotting-oranges │ ├── README.md │ └── rotting-oranges.cpp ├── russian-doll-envelopes │ └── README.md ├── satisfiability-of-equality-equations │ ├── README.md │ └── satisfiability-of-equality-equations.cpp ├── score-of-parentheses │ ├── README.md │ └── score-of-parentheses.cpp ├── search-a-2d-matrix-ii │ ├── README.md │ └── search-a-2d-matrix-ii.cpp ├── search-a-2d-matrix │ ├── README.md │ └── search-a-2d-matrix.cpp ├── search-in-a-binary-search-tree │ ├── README.md │ └── search-in-a-binary-search-tree.cpp ├── search-in-rotated-sorted-array-ii │ ├── README.md │ └── search-in-rotated-sorted-array-ii.cpp ├── search-in-rotated-sorted-array │ ├── README.md │ └── search-in-rotated-sorted-array.cpp ├── serialize-and-deserialize-binary-tree │ ├── README.md │ └── serialize-and-deserialize-binary-tree.cpp ├── set-matrix-zeroes │ └── README.md ├── shortest-common-supersequence │ ├── README.md │ └── shortest-common-supersequence.cpp ├── shortest-completing-word │ ├── README.md │ └── shortest-completing-word.cpp ├── shortest-path-in-a-grid-with-obstacles-elimination │ ├── README.md │ └── shortest-path-in-a-grid-with-obstacles-elimination.cpp ├── shortest-path-in-binary-matrix │ ├── README.md │ └── shortest-path-in-binary-matrix.cpp ├── shortest-path-with-alternating-colors │ ├── README.md │ └── shortest-path-with-alternating-colors.cpp ├── shortest-subarray-with-sum-at-least-k │ ├── README.md │ └── shortest-subarray-with-sum-at-least-k.cpp ├── similar-string-groups │ ├── README.md │ └── similar-string-groups.cpp ├── single-element-in-a-sorted-array │ ├── README.md │ └── single-element-in-a-sorted-array.cpp ├── single-number-ii │ ├── README.md │ └── single-number-ii.cpp ├── single-number-iii │ ├── README.md │ └── single-number-iii.cpp ├── single-number │ ├── README.md │ └── single-number.cpp ├── sliding-window-maximum │ ├── README.md │ └── sliding-window-maximum.cpp ├── smallest-range-covering-elements-from-k-lists │ ├── README.md │ └── smallest-range-covering-elements-from-k-lists.cpp ├── smallest-subtree-with-all-the-deepest-nodes │ ├── README.md │ └── smallest-subtree-with-all-the-deepest-nodes.cpp ├── sort-characters-by-frequency │ ├── README.md │ └── sort-characters-by-frequency.cpp ├── sort-colors │ └── README.md ├── sort-list │ ├── README.md │ └── sort-list.cpp ├── soup-servings │ ├── README.md │ └── soup-servings.cpp ├── spiral-matrix │ ├── README.md │ └── spiral-matrix.cpp ├── split-linked-list-in-parts │ ├── README.md │ └── split-linked-list-in-parts.cpp ├── split-two-strings-to-make-palindrome │ ├── README.md │ └── split-two-strings-to-make-palindrome.cpp ├── sqrtx │ └── README.md ├── squares-of-a-sorted-array │ ├── README.md │ └── squares-of-a-sorted-array.cpp ├── stone-game-iii │ ├── README.md │ └── stone-game-iii.cpp ├── string-without-aaa-or-bbb │ ├── README.md │ └── string-without-aaa-or-bbb.cpp ├── subarray-product-less-than-k │ ├── README.md │ └── subarray-product-less-than-k.cpp ├── subarray-sum-equals-k │ ├── README.md │ └── subarray-sum-equals-k.cpp ├── subarrays-with-k-different-integers │ ├── README.md │ └── subarrays-with-k-different-integers.cpp ├── subdomain-visit-count │ └── README.md ├── subsets-ii │ ├── README.md │ └── subsets-ii.cpp ├── subsets │ ├── README.md │ └── subsets.cpp ├── substring-with-concatenation-of-all-words │ ├── README.md │ └── substring-with-concatenation-of-all-words.cpp ├── subtree-of-another-tree │ ├── README.md │ └── subtree-of-another-tree.cpp ├── sudoku-solver │ ├── README.md │ └── sudoku-solver.cpp ├── sum-of-mutated-array-closest-to-target │ ├── README.md │ └── sum-of-mutated-array-closest-to-target.cpp ├── sum-of-root-to-leaf-binary-numbers │ ├── README.md │ └── sum-of-root-to-leaf-binary-numbers.cpp ├── sum-of-square-numbers │ ├── README.md │ └── sum-of-square-numbers.cpp ├── sum-of-two-integers │ ├── README.md │ └── sum-of-two-integers.cpp ├── sum-root-to-leaf-numbers │ ├── README.md │ └── sum-root-to-leaf-numbers.cpp ├── surrounded-regions │ ├── README.md │ └── surrounded-regions.cpp ├── swap-nodes-in-pairs │ ├── README.md │ └── swap-nodes-in-pairs.cpp ├── symmetric-tree │ ├── README.md │ └── symmetric-tree.cpp ├── target-sum │ ├── README.md │ └── target-sum.cpp ├── task-scheduler │ ├── README.md │ └── task-scheduler.cpp ├── the-time-when-the-network-becomes-idle │ ├── README.md │ └── the-time-when-the-network-becomes-idle.cpp ├── time-based-key-value-store │ └── time-based-key-value-store.cpp ├── time-needed-to-inform-all-employees │ ├── README.md │ └── time-needed-to-inform-all-employees.cpp ├── top-k-frequent-elements │ ├── README.md │ └── top-k-frequent-elements.cpp ├── total-hamming-distance │ ├── README.md │ └── total-hamming-distance.cpp ├── trapping-rain-water-ii │ ├── README.md │ └── trapping-rain-water-ii.cpp ├── trapping-rain-water │ ├── README.md │ └── trapping-rain-water.cpp ├── triangle │ ├── README.md │ └── triangle.cpp ├── trim-a-binary-search-tree │ ├── README.md │ └── trim-a-binary-search-tree.cpp ├── two-sum-iv-input-is-a-bst │ ├── README.md │ └── two-sum-iv-input-is-a-bst.cpp ├── two-sum │ ├── README.md │ └── two-sum.cpp ├── unique-binary-search-trees-ii │ ├── README.md │ └── unique-binary-search-trees-ii.cpp ├── unique-email-addresses │ ├── README.md │ └── unique-email-addresses.cpp ├── unique-paths-ii │ ├── README.md │ └── unique-paths-ii.cpp ├── unique-paths │ ├── README.md │ └── unique-paths.cpp ├── valid-sudoku │ ├── README.md │ └── valid-sudoku.cpp ├── validate-binary-search-tree │ ├── README.md │ └── validate-binary-search-tree.cpp ├── validate-ip-address │ ├── README.md │ └── validate-ip-address.cpp ├── validate-stack-sequences │ └── README.md ├── verify-preorder-serialization-of-a-binary-tree │ ├── README.md │ └── verify-preorder-serialization-of-a-binary-tree.cpp ├── verifying-an-alien-dictionary │ ├── README.md │ └── verifying-an-alien-dictionary.cpp ├── vertical-order-traversal-of-a-binary-tree │ ├── README.md │ └── vertical-order-traversal-of-a-binary-tree.cpp ├── wiggle-subsequence │ ├── README.md │ └── wiggle-subsequence.cpp ├── wildcard-matching │ ├── README.md │ └── wildcard-matching.cpp ├── word-break-ii │ ├── README.md │ └── word-break-ii.cpp ├── word-break │ ├── README.md │ └── word-break.cpp ├── word-ladder-ii │ ├── README.md │ └── word-ladder-ii.cpp ├── word-ladder │ ├── README.md │ └── word-ladder.cpp ├── word-search-ii │ ├── README.md │ └── word-search-ii.cpp ├── word-search │ ├── README.md │ └── word-search.cpp └── xor-queries-of-a-subarray │ ├── README.md │ └── xor-queries-of-a-subarray.cpp ├── letter-combinations-of-a-phone-number ├── README.md └── letter-combinations-of-a-phone-number.py ├── manifest.json ├── problems ├── 3sum │ └── solution.py ├── 3sum_closest │ └── solution.py ├── 4sum │ └── solution.py ├── 4sum_ii │ └── solution.py ├── all_paths_from_source_to_target │ └── solution.py ├── ambiguous_coordinates │ └── solution.java ├── array_partition │ └── solution.py ├── as_far_from_land_as_possible │ └── solution.py ├── assign_cookies │ └── solution.py ├── asteroid_collision │ └── solution.py ├── average_of_levels_in_binary_tree │ └── solution.py ├── backspace_string_compare │ └── solution.py ├── balance_a_binary_search_tree │ └── solution.py ├── balanced_binary_tree │ └── solution.py ├── best_sightseeing_pair │ └── solution.py ├── best_time_to_buy_and_sell_stock │ └── solution.py ├── best_time_to_buy_and_sell_stock_ii │ └── solution.py ├── best_time_to_buy_and_sell_stock_iii │ └── solution.py ├── best_time_to_buy_and_sell_stock_with_cooldown │ └── solution.py ├── best_time_to_buy_and_sell_stock_with_transaction_fee │ └── solution.py ├── binary_search │ └── solution.py ├── binary_search_tree_to_greater_sum_tree │ └── solution.py ├── binary_tree_cameras │ └── solution.py ├── binary_tree_inorder_traversal │ └── solution.py ├── binary_tree_level_order_traversal │ └── solution.py ├── binary_tree_level_order_traversal_ii │ └── solution.py ├── binary_tree_maximum_path_sum │ └── solution.py ├── binary_tree_paths │ └── solution.py ├── binary_tree_postorder_traversal │ └── solution.py ├── binary_tree_preorder_traversal │ └── solution.py ├── binary_tree_right_side_view │ └── solution.py ├── binary_tree_tilt │ └── solution.py ├── binary_tree_zigzag_level_order_traversal │ └── solution.py ├── boats_to_save_people │ └── solution.py ├── can_place_flowers │ └── solution.py ├── candy │ └── solution.py ├── car_pooling │ └── solution.py ├── check_completeness_of_a_binary_tree │ └── solution.py ├── check_if_n_and_its_double_exist │ └── solution.py ├── check_if_the_sentence_is_pangram │ └── solution.py ├── check_if_two_string_arrays_are_equivalent │ └── solution.py ├── climbing_stairs │ └── solution.py ├── clone_graph │ └── solution.py ├── coin_change │ └── solution.py ├── coin_change_ii │ └── solution.py ├── construct_binary_search_tree_from_preorder_traversal │ └── solution.py ├── construct_binary_tree_from_preorder_and_inorder_traversal │ └── solution.py ├── construct_binary_tree_from_preorder_and_postorder_traversal │ └── solution.py ├── construct_target_array_with_multiple_sums │ └── solution.cpp ├── contains_duplicate │ └── solution.py ├── contains_duplicate_ii │ └── solution.py ├── contiguous_array │ └── solution.py ├── continuous_subarray_sum │ └── solution.py ├── convert_1d_array_into_2d_array │ └── solution.py ├── convert_bst_to_greater_tree │ └── solution.py ├── convert_sorted_array_to_binary_search_tree │ └── solution.py ├── convert_sorted_list_to_binary_search_tree │ ├── solution.java │ └── solution.py ├── count_binary_substrings │ └── solution.py ├── count_good_triplets │ └── solution.py ├── count_items_matching_a_rule │ └── solution.py ├── count_negative_numbers_in_a_sorted_matrix │ └── solution.py ├── count_number_of_teams │ └── solution.py ├── count_of_smaller_numbers_after_self │ └── solution.py ├── count_primes │ └── solution.cpp ├── count_sorted_vowel_strings │ └── solution.py ├── count_special_quadruplets │ └── solution.py ├── count_square_submatrices_with_all_ones │ └── solution.py ├── count_the_number_of_consistent_strings │ └── solution.py ├── counting_bits │ └── solution.py ├── course_schedule │ └── solution.py ├── course_schedule_ii │ └── solution.py ├── crawler_log_folder │ └── solution.py ├── create_target_array_in_the_given_order │ └── solution.py ├── decompress_run-length_encoded_list │ └── solution.py ├── decrypt_string_from_alphabet_to_integer_mapping │ └── solution.py ├── deepest_leaves_sum │ └── solution.py ├── defanging_an_ip_address │ └── solution.py ├── delete_and_earn │ └── solution.py ├── delete_node_in_a_bst │ └── solution.py ├── delete_node_in_a_linked_list │ └── solution.py ├── delete_operation_for_two_strings │ └── solution.py ├── determine_color_of_a_chessboard_square │ └── solution.py ├── determine_if_string_halves_are_alike │ └── solution.py ├── di_string_match │ └── solution.py ├── diagonal_traverse │ └── solution.py ├── diameter_of_binary_tree │ └── solution.py ├── divide_array_in_sets_of_k_consecutive_numbers │ └── solution.py ├── duplicate_zeros │ └── solution.py ├── edit_distance │ └── solution.py ├── egg_drop_with_2_eggs_and_n_floors │ └── solution.py ├── evaluate_reverse_polish_notation │ └── solution.py ├── excel_sheet_column_number │ └── solution.py ├── excel_sheet_column_title │ └── solution.py ├── factorial_trailing_zeroes │ └── solution.py ├── fair_candy_swap │ └── solution.py ├── fibonacci_number │ └── solution.py ├── final_prices_with_a_special_discount_in_a_shop │ └── solution.py ├── find_all_duplicates_in_an_array │ └── solution.py ├── find_all_possible_recipes_from_given_supplies │ └── solution.py ├── find_and_replace_pattern │ └── solution.py ├── find_bottom_left_tree_value │ └── solution.py ├── find_center_of_star_graph │ └── solution.py ├── find_duplicate_file_in_system │ └── solution.java ├── find_duplicate_subtrees │ └── solution.py ├── find_first_and_last_position_of_element_in_sorted_array │ └── solution.py ├── find_if_path_exists_in_graph │ └── solution.py ├── find_k_closest_elements │ └── solution.py ├── find_mode_in_binary_search_tree │ └── solution.py ├── find_numbers_with_even_number_of_digits │ └── solution.py ├── find_peak_element │ └── solution.java ├── find_pivot_index │ └── solution.py ├── find_the_duplicate_number │ └── solution.py ├── find_the_highest_altitude │ └── solution.py ├── find_the_index_of_the_first_occurrence_in_a_string │ └── solution.py ├── find_the_most_competitive_subsequence │ └── solution.py ├── find_the_smallest_divisor_given_a_threshold │ └── solution.py ├── find_the_town_judge │ └── solution.py ├── first_missing_positive │ └── solution.py ├── first_unique_character_in_a_string │ ├── solution.java │ └── solution.py ├── flatten_binary_tree_to_linked_list │ ├── solution.cpp │ └── solution.py ├── flip_string_to_monotone_increasing │ └── solution.py ├── flipping_an_image │ └── solution.py ├── generate_parentheses │ └── solution.py ├── global_and_local_inversions │ └── solution.py ├── goal_parser_interpretation │ └── solution.py ├── gray_code │ └── solution.py ├── happy_number │ └── solution.py ├── house_robber │ └── solution.py ├── house_robber_ii │ └── solution.py ├── how_many_numbers_are_smaller_than_the_current_number │ └── solution.py ├── implement_queue_using_stacks │ └── solution.py ├── implement_stack_using_queues │ └── solution.py ├── increasing_decreasing_string │ └── solution.py ├── increasing_order_search_tree │ └── solution.py ├── interleaving_string │ ├── solution.java │ └── solution.py ├── intersection_of_two_arrays │ └── solution.py ├── intersection_of_two_arrays_ii │ └── solution.py ├── intersection_of_two_linked_lists │ └── solution.py ├── invert_binary_tree │ └── solution.py ├── is_subsequence │ └── solution.py ├── island_perimeter │ └── solution.py ├── isomorphic_strings │ └── solution.py ├── jump_game │ └── solution.py ├── jump_game_ii │ └── solution.py ├── jump_game_iii │ └── solution.py ├── jump_game_vi │ └── solution.py ├── k_inverse_pairs_array │ └── solution.py ├── keys_and_rooms │ └── solution.py ├── kids_with_the_greatest_number_of_candies │ └── solution.py ├── kth_largest_element_in_a_stream │ └── solution.py ├── kth_largest_element_in_an_array │ └── solution.py ├── kth_missing_positive_number │ └── solution.py ├── kth_smallest_element_in_a_bst │ └── solution.py ├── kth_smallest_element_in_a_sorted_matrix │ └── solution.py ├── largest_number │ └── solution.py ├── largest_odd_number_in_string │ └── solution.cpp ├── largest_perimeter_triangle │ └── solution.py ├── largest_rectangle_in_histogram │ └── solution.py ├── last_stone_weight │ └── solution.py ├── leaf-similar_trees │ └── solution.py ├── lemonade_change │ └── solution.py ├── length_of_last_word │ └── solution.py ├── letter_case_permutation │ └── solution.py ├── letter_tile_possibilities │ └── solution.py ├── linked_list_cycle │ └── solution.py ├── linked_list_cycle_ii │ └── solution.py ├── linked_list_in_binary_tree │ └── solution.py ├── long_pressed_name │ └── solution.py ├── longest_common_prefix │ └── solution.py ├── longest_common_subsequence │ └── solution.py ├── longest_consecutive_sequence │ └── solution.py ├── longest_increasing_subsequence │ └── solution.py ├── longest_palindrome │ └── solution.py ├── longest_palindromic_subsequence │ └── solution.py ├── longest_palindromic_substring │ └── solution.py ├── longest_string_chain │ └── solution.java ├── longest_univalue_path │ └── solution.py ├── longest_valid_parentheses │ └── solution.py ├── lowest_common_ancestor_of_a_binary_search_tree │ └── solution.py ├── lowest_common_ancestor_of_a_binary_tree │ └── solution.py ├── lucky_numbers_in_a_matrix │ └── solution.py ├── majority_element │ └── solution.py ├── majority_element_ii │ └── solution.py ├── make_the_string_great │ └── solution.py ├── matchsticks_to_square │ └── solution.py ├── matrix_cells_in_distance_order │ └── solution.py ├── matrix_diagonal_sum │ └── solution.py ├── max_area_of_island │ └── solution.py ├── max_chunks_to_make_sorted │ └── solution.py ├── max_chunks_to_make_sorted_ii │ └── solution.py ├── max_consecutive_ones_iii │ └── solution.py ├── maximal_rectangle │ └── solution.py ├── maximize_sum_of_array_after_k_negations │ └── solution.py ├── maximize_the_confusion_of_an_exam │ └── solution.py ├── maximum_69_number │ └── solution.py ├── maximum_area_of_a_piece_of_cake_after_horizontal_and_vertical_cuts │ └── solution.py ├── maximum_binary_tree │ └── solution.py ├── maximum_depth_of_binary_tree │ └── solution.py ├── maximum_depth_of_n-ary_tree │ └── solution.py ├── maximum_difference_between_increasing_elements │ └── solution.py ├── maximum_difference_between_node_and_ancestor │ └── solution.py ├── maximum_distance_between_a_pair_of_values │ └── solution.py ├── maximum_erasure_value │ └── solution.java ├── maximum_length_of_subarray_with_positive_product │ └── solution.py ├── maximum_nesting_depth_of_the_parentheses │ └── solution.py ├── maximum_number_of_words_found_in_sentences │ └── solution.py ├── maximum_performance_of_a_team │ └── solution.py ├── maximum_points_you_can_obtain_from_cards │ └── solution.java ├── maximum_product_difference_between_two_pairs │ └── solution.py ├── maximum_product_of_two_elements_in_an_array │ └── solution.py ├── maximum_product_subarray │ └── solution.py ├── maximum_subarray │ └── solution.py ├── maximum_subarray_sum_with_one_deletion │ └── solution.py ├── maximum_sum_bst_in_binary_tree │ └── solution.py ├── maximum_sum_circular_subarray │ └── solution.py ├── maximum_units_on_a_truck │ └── solution.py ├── median_of_two_sorted_arrays │ └── solution.py ├── merge_intervals │ └── solution.py ├── merge_k_sorted_lists │ └── solution.py ├── merge_sorted_array │ └── solution.py ├── merge_strings_alternately │ └── solution.py ├── merge_two_binary_trees │ └── solution.py ├── merge_two_sorted_lists │ └── solution.py ├── middle_of_the_linked_list │ └── solution.py ├── min_cost_climbing_stairs │ └── solution.py ├── min_stack │ └── solution.py ├── minimize_maximum_pair_sum_in_array │ └── solution.cpp ├── minimum_absolute_difference │ └── solution.py ├── minimum_absolute_difference_in_bst │ └── solution.py ├── minimum_cost_to_move_chips_to_the_same_position │ └── solution.py ├── minimum_depth_of_binary_tree │ └── solution.py ├── minimum_difference_between_largest_and_smallest_value_in_three_moves │ └── solution.py ├── minimum_distance_between_bst_nodes │ └── solution.py ├── minimum_falling_path_sum │ └── solution.py ├── minimum_insertion_steps_to_make_a_string_palindrome │ └── solution.py ├── minimum_moves_to_equal_array_elements_ii │ └── solution.py ├── minimum_number_of_refueling_stops │ └── solution.py ├── minimum_operations_to_make_array_equal │ └── solution.py ├── minimum_operations_to_make_the_array_increasing │ └── solution.py ├── minimum_path_sum │ └── solution.py ├── minimum_score_triangulation_of_polygon │ └── solution.py ├── minimum_size_subarray_sum │ └── solution.py ├── minimum_time_to_type_word_using_special_typewriter │ └── solution.py ├── minimum_time_visiting_all_points │ └── solution.py ├── missing_number │ └── solution.py ├── most_frequent_subtree_sum │ └── solution.py ├── move_zeroes │ ├── solution.java │ └── solution.py ├── multiply_strings │ └── solution.py ├── my_calendar_i │ └── solution.py ├── n-ary_tree_postorder_traversal │ └── solution.py ├── n-ary_tree_preorder_traversal │ └── solution.py ├── n-queens │ └── solution.py ├── n-queens_ii │ └── solution.py ├── n-th_tribonacci_number │ └── solution.py ├── next_greater_element_i │ └── solution.py ├── next_greater_element_ii │ └── solution.py ├── next_greater_element_iii │ └── solution.py ├── next_permutation │ └── solution.py ├── non-decreasing_array │ └── solution.py ├── non-overlapping_intervals │ └── solution.py ├── number_of_good_pairs │ └── solution.py ├── number_of_good_ways_to_split_a_string │ └── solution.py ├── number_of_islands │ └── solution.py ├── number_of_matching_subsequences │ └── solution.py ├── number_of_operations_to_make_network_connected │ └── solution.py ├── number_of_pairs_of_strings_with_concatenation_equal_to_target │ └── solution.cpp ├── number_of_provinces │ └── solution.py ├── number_of_students_unable_to_eat_lunch │ └── solution.py ├── number_of_subarrays_with_bounded_maximum │ └── solution.py ├── open_the_lock │ └── solution.java ├── out_of_boundary_paths │ └── solution.py ├── palindrome_linked_list │ └── solution.py ├── palindrome_pairs │ └── solution.py ├── palindrome_partitioning │ └── solution.py ├── palindromic_substrings │ └── solution.py ├── partition_array_into_three_parts_with_equal_sum │ └── solution.py ├── partition_equal_subset_sum │ └── solution.py ├── partitioning_into_minimum_number_of_deci-binary_numbers │ └── solution.py ├── pascal's_triangle │ └── solution.py ├── pascal's_triangle_ii │ └── solution.py ├── path_sum │ └── solution.py ├── path_sum_ii │ └── solution.py ├── path_sum_iii │ └── solution.py ├── permutation_sequence │ └── solution.py ├── permutations │ └── solution.py ├── plus_one │ └── solution.py ├── pow(x,_n) │ └── solution.py ├── power_of_four │ └── solution.py ├── power_of_three │ └── solution.py ├── power_of_two │ └── solution.py ├── prefix_and_suffix_search │ └── solution.java ├── product_of_array_except_self │ └── solution.py ├── projection_area_of_3d_shapes │ └── solution.py ├── range_sum_of_bst │ └── solution.py ├── range_sum_query_-_mutable │ └── solution.py ├── range_sum_query_2d_-_immutable │ └── solution.py ├── redundant_connection │ └── solution.py ├── relative_sort_array │ └── solution.py ├── remove_all_adjacent_duplicates_in_string │ └── solution.py ├── remove_duplicate_letters │ └── solution.py ├── remove_duplicates_from_sorted_array │ └── solution.py ├── remove_duplicates_from_sorted_list │ └── solution.py ├── remove_duplicates_from_sorted_list_ii │ └── solution.py ├── remove_linked_list_elements │ └── solution.py ├── remove_nth_node_from_end_of_list │ └── solution.py ├── reorder_list │ └── solution.py ├── reorganize_string │ └── solution.py ├── repeated_substring_pattern │ └── solution.java ├── replace_all_digits_with_characters │ └── solution.py ├── replace_elements_with_greatest_element_on_right_side │ └── solution.py ├── reshape_the_matrix │ └── solution.py ├── reverse_integer │ └── solution.py ├── reverse_linked_list │ └── solution.py ├── reverse_linked_list_ii │ └── solution.py ├── reverse_nodes_in_k-group │ └── solution.py ├── reverse_only_letters │ └── solution.py ├── reverse_string │ └── solution.py ├── reverse_vowels_of_a_string │ └── solution.py ├── reverse_words_in_a_string │ └── solution.py ├── reverse_words_in_a_string_iii │ └── solution.py ├── richest_customer_wealth │ └── solution.py ├── roman_to_integer │ └── solution.py ├── rotate_array │ └── solution.py ├── rotate_image │ └── solution.py ├── rotate_string │ └── solution.py ├── running_sum_of_1d_array │ ├── solution.java │ └── solution.py ├── same_tree │ ├── solution.java │ └── solution.py ├── scramble_string │ └── solution.py ├── search_a_2d_matrix │ └── solution.py ├── search_a_2d_matrix_ii │ └── solution.py ├── search_in_a_binary_search_tree │ └── solution.py ├── search_in_rotated_sorted_array │ └── solution.py ├── sequential_digits │ └── solution.py ├── set_matrix_zeroes │ └── solution.py ├── shift_2d_grid │ └── solution.py ├── shortest_common_supersequence_ │ └── solution.py ├── shortest_distance_to_a_character │ └── solution.py ├── shortest_unsorted_continuous_subarray │ └── solution.py ├── shuffle_string │ └── solution.py ├── shuffle_the_array │ └── solution.py ├── single_number │ └── solution.py ├── sliding_window_maximum │ └── solution.py ├── smallest_range_ii │ └── solution.py ├── smallest_subsequence_of_distinct_characters │ └── solution.py ├── sort_an_array │ └── solution.py ├── sort_array_by_parity │ └── solution.py ├── sort_array_by_parity_ii │ └── solution.py ├── sort_colors │ └── solution.py ├── sort_integers_by_the_number_of_1_bits │ └── solution.py ├── sort_integers_by_the_power_value │ └── solution.py ├── sort_list │ └── solution.py ├── sorting_the_sentence │ └── solution.py ├── special_array_with_x_elements_greater_than_or_equal_x │ └── solution.py ├── special_positions_in_a_binary_matrix │ └── solution.py ├── spiral_matrix │ └── solution.py ├── spiral_matrix_ii │ └── solution.py ├── split_a_string_in_balanced_strings │ └── solution.py ├── sqrt(x) │ └── solution.py ├── squares_of_a_sorted_array │ └── solution.py ├── stone_game_vii │ └── solution.py ├── subarray_sum_equals_k │ └── solution.py ├── subarray_sums_divisible_by_k │ └── solution.py ├── substrings_of_size_three_with_distinct_characters │ └── solution.py ├── subtract_the_product_and_sum_of_digits_of_an_integer │ └── solution.py ├── subtree_of_another_tree │ └── solution.py ├── sum_of_absolute_differences_in_a_sorted_array │ └── solution.py ├── sum_of_all_odd_length_subarrays │ └── solution.py ├── sum_of_all_subset_xor_totals │ └── solution.py ├── sum_of_digits_in_base_k │ └── solution.py ├── sum_of_left_leaves │ └── solution.py ├── sum_of_nodes_with_even-valued_grandparent │ └── solution.py ├── sum_of_root_to_leaf_binary_numbers │ └── solution.py ├── sum_of_subarray_minimums │ └── solution.py ├── sum_root_to_leaf_numbers │ └── solution.py ├── swap_nodes_in_pairs │ └── solution.py ├── swim_in_rising_water │ └── solution.py ├── symmetric_tree │ └── solution.py ├── target_sum │ └── solution.py ├── the_k_weakest_rows_in_a_matrix │ └── solution.py ├── to_lower_case │ └── solution.py ├── toeplitz_matrix │ └── solution.py ├── trapping_rain_water │ └── solution.py ├── truncate_sentence │ └── solution.py ├── two_sum │ └── solution.py ├── two_sum_ii_-_input_array_is_sorted │ └── solution.py ├── two_sum_iv_-_input_is_a_bst │ └── solution.py ├── unique_morse_code_words │ └── solution.py ├── unique_paths │ └── solution.py ├── unique_paths_ii │ └── solution.py ├── univalued_binary_tree │ ├── solution.java │ └── solution.py ├── utf-8_validation │ └── solution.py ├── valid_anagram │ └── solution.py ├── valid_number │ └── solution.java ├── valid_palindrome │ └── solution.py ├── valid_palindrome_ii │ └── solution.py ├── valid_parentheses │ └── solution.py ├── valid_sudoku │ └── solution.py ├── validate_binary_search_tree │ └── solution.py ├── word_break │ ├── solution.java │ └── solution.py └── xor_operation_in_an_array │ └── solution.py ├── readme.md └── service-worker.js /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "themes/PaperMod"] 2 | path = themes/PaperMod 3 | url = https://github.com/adityatelange/hugo-PaperMod 4 | -------------------------------------------------------------------------------- /0001-two-sum/0001-two-sum.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def twoSum(self, nums: List[int], target: int) -> List[int]: 3 | taken = {} 4 | for i, num in enumerate(nums): 5 | if target - num in taken: 6 | return [taken[target - num], i] 7 | taken[num] = i 8 | return False -------------------------------------------------------------------------------- /0002-add-two-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0003-longest-substring-without-repeating-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0004-median-of-two-sorted-arrays/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0005-longest-palindromic-substring/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0010-regular-expression-matching/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0012-integer-to-roman/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0014-longest-common-prefix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0017-letter-combinations-of-a-phone-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0020-valid-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0022-generate-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0027-remove-element/0027-remove-element.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def removeElement(self, nums: List[int], val: int) -> int: 3 | i = 0 4 | for num in nums: 5 | if num != val: 6 | nums[i] = num 7 | i += 1 8 | return i -------------------------------------------------------------------------------- /0027-remove-element/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0028-find-the-index-of-the-first-occurrence-in-a-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0035-search-insert-position/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0037-sudoku-solver/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0043-multiply-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0044-wildcard-matching/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0045-jump-game-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0050-powx-n/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0051-n-queens/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0052-n-queens-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0053-maximum-subarray/0053-maximum-subarray.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxSubArray(self, nums: List[int]) -> int: 3 | cs = 0 4 | ms = nums[0] 5 | for num in nums: 6 | cs = max(cs+num, num) 7 | ms = max(ms, cs) 8 | 9 | return ms -------------------------------------------------------------------------------- /0053-maximum-subarray/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0056-merge-intervals/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0057-insert-interval/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0064-minimum-path-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0070-climbing-stairs/0070-climbing-stairs.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def climbStairs(self, n: int) -> int: 3 | dp = [0, 1, 2] 4 | for i in range(3, n+1): 5 | dp.append(dp[i-2] + dp[i-1]) 6 | 7 | return dp[n] -------------------------------------------------------------------------------- /0072-edit-distance/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0085-maximal-rectangle/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0086-partition-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0087-scramble-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0091-decode-ways/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0093-restore-ip-addresses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0094-binary-tree-inorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0096-unique-binary-search-trees/0096-unique-binary-search-trees.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def numTrees(self, n: int) -> int: 3 | dp = [0]*(n+1) 4 | dp[0] = 1 5 | for i in range(1, n+1): 6 | for j in range(i): 7 | dp[i] += dp[j]*dp[i-j-1] 8 | 9 | return dp[n] -------------------------------------------------------------------------------- /0101-symmetric-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0102-binary-tree-level-order-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0103-binary-tree-zigzag-level-order-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0105-construct-binary-tree-from-preorder-and-inorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0106-construct-binary-tree-from-inorder-and-postorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0109-convert-sorted-list-to-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0110-balanced-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0114-flatten-binary-tree-to-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0115-distinct-subsequences/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0117-populating-next-right-pointers-in-each-node-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProfit(self, prices: List[int]) -> int: 3 | res = 0 4 | mini = prices[0] 5 | for p in prices[1:]: 6 | res = max(res, p - mini) 7 | mini = min(mini, p) 8 | return res -------------------------------------------------------------------------------- /0122-best-time-to-buy-and-sell-stock-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0124-binary-tree-maximum-path-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0129-sum-root-to-leaf-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0135-candy/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0136-single-number/0136-single-number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def singleNumber(self, nums: List[int]) -> int: 3 | res = 0 4 | for n in nums: 5 | res = res ^ n 6 | return res -------------------------------------------------------------------------------- /0137-single-number-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0139-word-break/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0140-word-break-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0142-linked-list-cycle-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0144-binary-tree-preorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0145-binary-tree-postorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0146-lru-cache/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0147-insertion-sort-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0149-max-points-on-a-line/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0151-reverse-words-in-a-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0166-fraction-to-recurring-decimal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0169-majority-element/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0171-excel-sheet-column-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0175-combine-two-tables/0175-combine-two-tables.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select firstName, lastname, city, state from Person left join Address on Person.personId = Address.personId; 3 | -------------------------------------------------------------------------------- /0176-second-highest-salary/0176-second-highest-salary.sql: -------------------------------------------------------------------------------- 1 | # select max(salary) as "SecondHighestSalary" from employee where salary not in (select max(salary) from employee); 2 | 3 | select (select distinct salary from employee order by salary desc limit 1 offset 1) as SecondHighestSalary; 4 | 5 | -------------------------------------------------------------------------------- /0176-second-highest-salary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0182-duplicate-emails/0182-duplicate-emails.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select email from person 3 | group by email having count(id) > 1; -------------------------------------------------------------------------------- /0182-duplicate-emails/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0183-customers-who-never-order/0183-customers-who-never-order.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select Customers.name as 'Customers' from Customers where Customers.id not in (select customerId from Orders) -------------------------------------------------------------------------------- /0189-rotate-array/0189-rotate-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def rotate(self, nums: List[int], k: int) -> None: 3 | k = k % len(nums) 4 | nums.reverse() 5 | nums[:k] = nums[:k][::-1] 6 | nums[k:] = nums[k:][::-1] 7 | return nums -------------------------------------------------------------------------------- /0190-reverse-bits/0190-reverse-bits.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reverseBits(self, n: int) -> int: 3 | res = 0 4 | for i in range(32): 5 | if n&(1< int: 3 | res = 0 4 | for i in range(32): 5 | if n&(1< w2.Temperature AND DATEDIFF(w1.recordDate , w2.recordDate) = 1 -------------------------------------------------------------------------------- /0197-rising-temperature/NOTES.md: -------------------------------------------------------------------------------- 1 | ```mysql 2 | ​ 3 | SELECT w1.id 4 | FROM Weather AS w1 , Weather AS w2 5 | WHERE w1.Temperature > w2.Temperature AND DATEDIFF(w1.recordDate , w2.recordDate) = 1 6 | ​ 7 | ``` -------------------------------------------------------------------------------- /0198-house-robber/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0199-binary-tree-right-side-view/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0200-number-of-islands/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0201-bitwise-and-of-numbers-range/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0208-implement-trie-prefix-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0211-design-add-and-search-words-data-structure/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0212-word-search-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0222-count-complete-tree-nodes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0223-rectangle-area/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0224-basic-calculator/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0227-basic-calculator-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0229-majority-element-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0234-palindrome-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0236-lowest-common-ancestor-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0238-product-of-array-except-self/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0239-sliding-window-maximum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0263-ugly-number/0263-ugly-number.py: -------------------------------------------------------------------------------- 1 | # https://youtu.be/M0Zay1Qr9ws 2 | 3 | class Solution: 4 | def isUgly(self, n: int) -> bool: 5 | if n <= 0: return False 6 | for p in [2, 3, 5]: 7 | while n % p == 0: 8 | n = n // p 9 | 10 | return n == 1 -------------------------------------------------------------------------------- /0263-ugly-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0264-ugly-number-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0274-h-index/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0275-h-index-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0279-perfect-squares/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0290-word-pattern/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0300-longest-increasing-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0306-additive-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0312-burst-balloons/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0313-super-ugly-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0318-maximum-product-of-word-lengths/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0322-coin-change/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0324-wiggle-sort-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0329-longest-increasing-path-in-a-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0331-verify-preorder-serialization-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0332-reconstruct-itinerary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0337-house-robber-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0347-top-k-frequent-elements/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0354-russian-doll-envelopes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0355-design-twitter/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0357-count-numbers-with-unique-digits/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0363-max-sum-of-rectangle-no-larger-than-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0367-valid-perfect-square/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0368-largest-divisible-subset/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0373-find-k-pairs-with-smallest-sums/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0374-guess-number-higher-or-lower/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0375-guess-number-higher-or-lower-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0376-wiggle-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0377-combination-sum-iv/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0378-kth-smallest-element-in-a-sorted-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0380-insert-delete-getrandom-o1/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0382-linked-list-random-node/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0384-shuffle-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0391-perfect-rectangle/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0392-is-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0399-evaluate-division/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0406-queue-reconstruction-by-height/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0407-trapping-rain-water-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0415-add-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0416-partition-equal-subset-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0424-longest-repeating-character-replacement/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0436-find-right-interval/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0441-arranging-coins/0441-arranging-coins.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def arrangeCoins(self, n: int) -> int: 3 | return int((-1 + (1+4*n*2)**(1/2))//2) -------------------------------------------------------------------------------- /0441-arranging-coins/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0443-string-compression/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0447-number-of-boomerangs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0452-minimum-number-of-arrows-to-burst-balloons/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0456-132-pattern/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0461-hamming-distance/0461-hamming-distance.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def hammingDistance(self, x: int, y: int) -> int: 3 | res = 0 4 | for i in range(32): 5 | if x&(1< int: 3 | nums.sort() 4 | n = len(nums) 5 | mid = n//2 6 | return sum(abs(nums[i] - nums[mid]) for i in range(n)) -------------------------------------------------------------------------------- /0467-unique-substrings-in-wraparound-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0473-matchsticks-to-square/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0474-ones-and-zeroes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0475-heaters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0493-reverse-pairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0494-target-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0506-relative-ranks/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0511-game-play-analysis-i/0511-game-play-analysis-i.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | A.player_id, 3 | MIN(A.event_date) AS first_login 4 | FROM 5 | Activity A 6 | GROUP BY 7 | A.player_id; -------------------------------------------------------------------------------- /0511-game-play-analysis-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0513-find-bottom-left-tree-value/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0523-continuous-subarray-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0526-beautiful-arrangement/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0530-minimum-absolute-difference-in-bst/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0535-encode-and-decode-tinyurl/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0541-reverse-string-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0554-brick-wall/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0565-array-nesting/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0567-permutation-in-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0584-find-customer-referee/0584-find-customer-referee.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select name from Customer where referee_id != 2 or referee_id is null; -------------------------------------------------------------------------------- /0586-customer-placing-the-largest-number-of-orders/0586-customer-placing-the-largest-number-of-orders.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select customer_number from (select customer_number from orders group by customer_number order by count(customer_number) desc) as customer_number limit 1; -------------------------------------------------------------------------------- /0586-customer-placing-the-largest-number-of-orders/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0595-big-countries/0595-big-countries.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT name, population, area FROM World WHERE population >= 25000000 OR area >= 3000000; -------------------------------------------------------------------------------- /0595-big-countries/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0605-can-place-flowers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0606-construct-string-from-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0607-sales-person/0607-sales-person.sql: -------------------------------------------------------------------------------- 1 | select s.name 2 | from Orders o join Company c on (o.com_id = c.com_id and c.name = 'RED') 3 | right join SalesPerson s on s.sales_id = o.sales_id 4 | where o.sales_id is null; -------------------------------------------------------------------------------- /0607-sales-person/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0608-tree-node/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0622-design-circular-queue/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0627-swap-salary/0627-swap-salary.sql: -------------------------------------------------------------------------------- 1 | update Salary 2 | set sex = if (sex = 'm', 'f', 'm'); 3 | 4 | 5 | 6 | # update Salary 7 | # set sex = case sex when 'm' then 'f' else 'm' end; 8 | -------------------------------------------------------------------------------- /0627-swap-salary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0646-maximum-length-of-pair-chain/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0647-palindromic-substrings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0658-find-k-closest-elements/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0667-beautiful-arrangement-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0669-trim-a-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0673-number-of-longest-increasing-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0678-valid-parenthesis-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0682-baseball-game/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0686-repeated-string-match/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0687-longest-univalue-path/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0688-knight-probability-in-chessboard/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0689-maximum-sum-of-3-non-overlapping-subarrays/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0691-stickers-to-spell-word/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0698-partition-to-k-equal-sum-subsets/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0704-binary-search/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0713-subarray-product-less-than-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0714-best-time-to-buy-and-sell-stock-with-transaction-fee/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0729-my-calendar-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0731-my-calendar-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0740-delete-and-earn/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0743-network-delay-time/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0746-min-cost-climbing-stairs/0746-min-cost-climbing-stairs.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minCostClimbingStairs(self, cost: List[int]) -> int: 3 | cost += [0] 4 | for i in range(2, len(cost)): 5 | cost[i] += min(cost[i-1], cost[i-2]) 6 | return min(cost[-1], cost[-2]) -------------------------------------------------------------------------------- /0752-open-the-lock/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0778-swim-in-rising-water/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0787-cheapest-flights-within-k-stops/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0790-domino-and-tromino-tiling/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0797-all-paths-from-source-to-target/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0802-find-eventual-safe-states/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0812-largest-triangle-area/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0813-largest-sum-of-averages/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0823-binary-trees-with-factors/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0846-hand-of-straights/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0853-car-fleet/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0875-koko-eating-bananas/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0876-middle-of-the-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0877-stone-game/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0881-boats-to-save-people/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0889-construct-binary-tree-from-preorder-and-postorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0894-all-possible-full-binary-trees/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0895-maximum-frequency-stack/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0912-sort-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0953-verifying-an-alien-dictionary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0958-check-completeness-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0974-subarray-sums-divisible-by-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0979-distribute-coins-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0981-time-based-key-value-store/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0983-minimum-cost-for-tickets/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /0987-vertical-order-traversal-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1-two-sum/1-two-sum.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def twoSum(self, nums: List[int], target: int) -> List[int]: 3 | dic = {} 4 | for i, ch in enumerate(nums): 5 | n = target - ch 6 | if n in dic: 7 | return [dic[n], i] 8 | dic[ch] = i 9 | 10 | -------------------------------------------------------------------------------- /1-two-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /10-regular-expression-matching/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /100-same-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1004-max-consecutive-ones-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1005-maximize-sum-of-array-after-k-negations/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1008-construct-binary-search-tree-from-preorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /101-symmetric-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1011-capacity-to-ship-packages-within-d-days/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1014-best-sightseeing-pair/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /102-binary-tree-level-order-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1027-longest-arithmetic-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1029-two-city-scheduling/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /103-binary-tree-zigzag-level-order-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1035-uncrossed-lines/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1038-binary-search-tree-to-greater-sum-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /104-maximum-depth-of-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1046-last-stone-weight/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /105-construct-binary-tree-from-preorder-and-inorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1050-actors-and-directors-who-cooperated-at-least-three-times/1050-actors-and-directors-who-cooperated-at-least-three-times.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select actor_id, director_id 3 | from ActorDirector group by actor_id, director_id 4 | having count(timestamp) >= 3; -------------------------------------------------------------------------------- /106-construct-binary-tree-from-inorder-and-postorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1071-greatest-common-divisor-of-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1079-letter-tile-possibilities/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /108-convert-sorted-array-to-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1084-sales-analysis-iii/1084-sales-analysis-iii.sql: -------------------------------------------------------------------------------- 1 | select p.product_id, p.product_name 2 | from product as p inner join sales as s 3 | on p.product_id = s.product_id group by product_id having 4 | '2019-01-01' <= min(sale_date) and max(sale_date) <= '2019-03-31'; -------------------------------------------------------------------------------- /109-convert-sorted-list-to-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1092-shortest-common-supersequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1094-car-pooling/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /11-container-with-most-water/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /110-balanced-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1106-parsing-a-boolean-expression/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1114-print-in-order/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /113-path-sum-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1130-minimum-cost-tree-from-leaf-values/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /114-flatten-binary-tree-to-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1141-user-activity-for-the-past-30-days-i/1141-user-activity-for-the-past-30-days-i.sql: -------------------------------------------------------------------------------- 1 | select activity_date as day, count(distinct user_id) as active_users from activity where activity_date > '2019-06-27' and activity_date <= '2019-07-27' group by activity_date; -------------------------------------------------------------------------------- /1143-longest-common-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1148-article-views-i/1148-article-views-i.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select distinct author_id as id from Views where author_id = viewer_id order by id asc; -------------------------------------------------------------------------------- /1148-article-views-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /115-distinct-subsequences/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1158-market-analysis-i/1158-market-analysis-i.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select u.user_id as buyer_id, u.join_date, ifnull(count(order_date), 0) as orders_in_2019 3 | from users as u left join orders as o on year(order_date) = '2019' and u.user_id = o.buyer_id 4 | group by user_id; -------------------------------------------------------------------------------- /1158-market-analysis-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /116-populating-next-right-pointers-in-each-node/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1162-as-far-from-land-as-possible/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /118-pascals-triangle/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1189-maximum-number-of-balloons/1189-maximum-number-of-balloons.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxNumberOfBalloons(self, text: str) -> int: 3 | cd = collections.Counter(text) 4 | return min(cd['b'], cd['a'], cd['l']//2, cd['o']//2, cd['n']) -------------------------------------------------------------------------------- /1189-maximum-number-of-balloons/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /119-pascals-triangle-ii/119-pascals-triangle-ii.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def getRow(self, rowIndex: int) -> List[int]: 3 | arr = [1] * (rowIndex+1) 4 | 5 | for i in range(2, rowIndex+1): 6 | for j in range(i-1, 0, -1): 7 | arr[j] += arr[j-1] 8 | 9 | return arr -------------------------------------------------------------------------------- /119-pascals-triangle-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /12-integer-to-roman/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /120-triangle/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1200-minimum-absolute-difference/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1207-unique-number-of-occurrences/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1208-get-equal-substrings-within-budget/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1209-remove-all-adjacent-duplicates-in-string-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /121-best-time-to-buy-and-sell-stock/121-best-time-to-buy-and-sell-stock.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProfit(self, prices: List[int]) -> int: 3 | res = 0 4 | mini = prices[0] 5 | for i in prices: 6 | mini = min(i, mini) 7 | res = max(res, i-mini) 8 | return res -------------------------------------------------------------------------------- /121-best-time-to-buy-and-sell-stock/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /122-best-time-to-buy-and-sell-stock-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1220-count-vowels-permutation/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1221-split-a-string-in-balanced-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /123-best-time-to-buy-and-sell-stock-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1235-maximum-profit-in-job-scheduling/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1239-maximum-length-of-a-concatenated-string-with-unique-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /124-binary-tree-maximum-path-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /126-word-ladder-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1268-search-suggestions-system/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /127-word-ladder/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /128-longest-consecutive-sequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1288-remove-covered-intervals/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /129-sum-root-to-leaf-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1296-divide-array-in-sets-of-k-consecutive-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /13-roman-to-integer/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /130-surrounded-regions/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1302-deepest-leaves-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1306-jump-game-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1309-decrypt-string-from-alphabet-to-integer-mapping/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /131-palindrome-partitioning/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1312-minimum-insertion-steps-to-make-a-string-palindrome/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1318-minimum-flips-to-make-a-or-b-equal-to-c/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1319-number-of-operations-to-make-network-connected/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1323_Maximum_69_Number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maximum69Number (self, num: int) -> int: 3 | # Replace first 6 with 9 if exists 4 | return(str(num).replace('6', '9', 1)) 5 | -------------------------------------------------------------------------------- /133-clone-graph/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /134-gas-station/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1342-number-of-steps-to-reduce-a-number-to-zero/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1345-jump-game-iv/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1347-minimum-number-of-steps-to-make-two-strings-anagram/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /135-candy/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /136-single-number/136-single-number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def singleNumber(self, nums: List[int]) -> int: 3 | res = nums[0] 4 | 5 | for i in range(1, len(nums)): 6 | res = res ^ nums[i] 7 | 8 | return res -------------------------------------------------------------------------------- /136-single-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1367-linked-list-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /137-single-number-ii/137-single-number-ii.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def singleNumber(self, nums: List[int]) -> int: 3 | ones = 0; twos = 0 4 | 5 | for num in nums: 6 | ones = (ones ^ num) & (~ twos) 7 | twos = (twos ^ num) & (~ ones) 8 | 9 | return ones -------------------------------------------------------------------------------- /1373-maximum-sum-bst-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /138-copy-list-with-random-pointer/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1382-balance-a-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1383-maximum-performance-of-a-team/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /139-word-break/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1393-capital-gain-loss/1393-capital-gain-loss.sql: -------------------------------------------------------------------------------- 1 | select stock_name, 2 | sum(case when operation = 'Buy' then -price 3 | else price 4 | end) as capital_gain_loss 5 | from Stocks 6 | group by stock_name -------------------------------------------------------------------------------- /1395-count-number-of-teams/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /14-longest-common-prefix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /140-word-break-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1402-reducing-dishes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1405-longest-happy-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1407-top-travellers/1407-top-travellers.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select u.name, ifnull(sum(r.distance), 0) as travelled_distance 3 | from users as u left join rides as r on u.id = r.user_id 4 | group by u.id 5 | order by travelled_distance desc, name asc -------------------------------------------------------------------------------- /1407-top-travellers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /141-linked-list-cycle/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /142-linked-list-cycle-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1423-maximum-points-you-can-obtain-from-cards/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /143-reorder-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /144-binary-tree-preorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1444-number-of-ways-of-cutting-a-pizza/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1446-consecutive-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1448-count-good-nodes-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /146-lru-cache/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1461-check-if-a-string-contains-all-binary-codes-of-size-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1465-maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /147-insertion-sort-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1472-design-browser-history/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /148-sort-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1480-running-sum-of-1d-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1484-group-sold-products-by-the-date/1484-group-sold-products-by-the-date.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select sell_date, count(distinct product) as num_sold, group_concat(distinct product order by product asc separator ',') as products from Activities group by sell_date order by sell_date asc; -------------------------------------------------------------------------------- /1493-longest-subarray-of-1s-after-deleting-one-element/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /15-3sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1509-minimum-difference-between-largest-and-smallest-value-in-three-moves/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /151-reverse-words-in-a-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /152-maximum-product-subarray/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1527-patients-with-a-condition/1527-patients-with-a-condition.sql: -------------------------------------------------------------------------------- 1 | select * from Patients where conditions like "DIAB1%" or conditions like "% DIAB1%" -------------------------------------------------------------------------------- /1530-number-of-good-leaf-nodes-pairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1539-kth-missing-positive-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1545-find-kth-bit-in-nth-binary-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /155-min-stack/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1581-customer-who-visited-but-did-not-make-any-transactions/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1584-min-cost-to-connect-all-points/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1587-bank-account-summary-ii/1587-bank-account-summary-ii.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select u.name, sum(t.amount) as balance 3 | from users as u left join transactions as t 4 | on u.account = t.account 5 | group by u.account having balance > 10000; -------------------------------------------------------------------------------- /16-3sum-closest/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /160-intersection-of-two-linked-lists/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1605-find-valid-matrix-given-row-and-column-sums/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1614-maximum-nesting-depth-of-the-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /162-find-peak-element/NOTES.md: -------------------------------------------------------------------------------- 1 | Instead of writting mid = (l + r) // 2 we should write mid = l + (r - l) // 2 because of INTEGER OVERFLOW in the former case 2 | ​ -------------------------------------------------------------------------------- /1631-path-with-minimum-effort/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /165-compare-version-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1667-fix-names-in-a-table/1667-fix-names-in-a-table.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select user_id, concat(upper(substring(name, 1, 1)), lower(substring(name, 2, length(name)))) as name from Users order by user_id asc; -------------------------------------------------------------------------------- /1667-fix-names-in-a-table/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1673-find-the-most-competitive-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1685-sum-of-absolute-differences-in-a-sorted-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /168_Excel_Sheet_Column_Title.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def convertToTitle(self, n: int) -> str: 3 | res = "" 4 | while n > 0: 5 | n -= 1 6 | res = chr(65 + n % 26) + res 7 | n //= 26 8 | return res 9 | -------------------------------------------------------------------------------- /169-majority-element/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1693-daily-leads-and-partners/1693-daily-leads-and-partners.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT 3 | date_id, make_name, 4 | COUNT(DISTINCT lead_id) AS unique_leads, 5 | COUNT(DISTINCT partner_id) AS unique_partners 6 | FROM DailySales 7 | GROUP BY make_name, date_id -------------------------------------------------------------------------------- /1693-daily-leads-and-partners/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1695-maximum-erasure-value/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /17-letter-combinations-of-a-phone-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1710-maximum-units-on-a-truck/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /172-factorial-trailing-zeroes/172-factorial-trailing-zeroes.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def trailingZeroes(self, n: int) -> int: 3 | res = 0 4 | 5 | while n > 0: 6 | n = n// 5 7 | res += n 8 | 9 | return res -------------------------------------------------------------------------------- /172-factorial-trailing-zeroes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1729-find-followers-count/1729-find-followers-count.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select user_id, count(*) as followers_count from followers group by user_id order by user_id asc; -------------------------------------------------------------------------------- /1729-find-followers-count/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /173-binary-search-tree-iterator/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1741-find-total-time-spent-by-each-employee/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1757-recyclable-and-low-fat-products/1757-recyclable-and-low-fat-products.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT product_id from Products where low_fats = "Y" and recyclable = "Y"; -------------------------------------------------------------------------------- /1757-recyclable-and-low-fat-products/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /179-largest-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1795-rearrange-products-table/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /18-4sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1844-replace-all-digits-with-characters/1844-replace-all-digits-with-characters.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def replaceDigits(self, s: str) -> str: 3 | s = list(s) 4 | for i in range(1, len(s), 2): 5 | s[i] = chr(ord(s[i-1]) + int(s[i])) 6 | 7 | return "".join(s) -------------------------------------------------------------------------------- /1844-replace-all-digits-with-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1845-seat-reservation-manager/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1849-splitting-a-string-into-descending-consecutive-values/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1851-minimum-interval-to-include-each-query/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1855-maximum-distance-between-a-pair-of-values/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1866-number-of-ways-to-rearrange-sticks-with-k-sticks-visible/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1871-jump-game-vii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1873-calculate-special-bonus/1873-calculate-special-bonus.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select employee_id, salary * (employee_id%2) * (name not like "M%") as bonus 3 | from Employees 4 | order by employee_id; -------------------------------------------------------------------------------- /1873-calculate-special-bonus/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /188-best-time-to-buy-and-sell-stock-iv/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1882-process-tasks-using-servers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1884-egg-drop-with-2-eggs-and-n-floors/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1888-minimum-number-of-flips-to-make-the-binary-string-alternating/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /189-rotate-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1890-the-latest-login-in-2020/1890-the-latest-login-in-2020.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | user_id, 3 | MAX(time_stamp) AS last_stamp #obtaining latest login for all users 4 | FROM Logins 5 | WHERE YEAR(time_stamp) = 2020 #filtering for login dates with year 2020 in timestamp 6 | GROUP BY user_id; 7 | -------------------------------------------------------------------------------- /1890-the-latest-login-in-2020/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1898-maximum-number-of-removable-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /19-remove-nth-node-from-end-of-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1905-count-sub-islands/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1911-maximum-alternating-subsequence-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1921-eliminate-maximum-number-of-monsters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1922-count-good-numbers/1922-count-good-numbers.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def countGoodNumbers(self, n: int) -> int: 3 | ans = 1 4 | rem = n % 2 5 | n -= rem 6 | ans = pow(20, n//2, 10**9 + 7) 7 | if rem == 1: 8 | ans *= 5 9 | return ans % (10**9 + 7) -------------------------------------------------------------------------------- /1922-count-good-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1930-unique-length-3-palindromic-subsequences/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1963-minimum-number-of-swaps-to-make-the-string-balanced/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1965-employees-with-missing-information/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1968-array-with-elements-not-equal-to-average-of-neighbors/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1971-find-if-path-exists-in-graph/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1974-minimum-time-to-type-word-using-special-typewriter/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /198-house-robber/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1980-find-unique-binary-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /1985-find-the-kth-largest-integer-in-the-array/1985-find-the-kth-largest-integer-in-the-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def kthLargestNumber(self, nums: List[str], k: int) -> str: 3 | for i, ch in enumerate(nums): 4 | nums[i] = int(ch) 5 | nums.sort() 6 | return str(nums[-k]) -------------------------------------------------------------------------------- /199-binary-tree-right-side-view/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2-add-two-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /20-valid-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /200-number-of-islands/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2001-number-of-pairs-of-interchangeable-rectangles/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2006-count-number-of-pairs-with-absolute-difference-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /202-happy-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2024-maximize-the-confusion-of-an-exam/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /206-reverse-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /207-course-schedule/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /208-implement-trie-prefix-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /209-minimum-size-subarray-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2091-removing-minimum-and-maximum-from-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /21-merge-two-sorted-lists/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /210-course-schedule-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /211-design-add-and-search-words-data-structure/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /213-house-robber-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /214-shortest-palindrome/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /215-kth-largest-element-in-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2187-minimum-time-to-complete-trips/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /22-generate-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /221-maximal-square/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /222-count-complete-tree-nodes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /224-basic-calculator/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2241-design-an-atm-machine/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /225-implement-stack-using-queues/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /227-basic-calculator-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2271-maximum-white-tiles-covered-by-a-carpet/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /228-summary-ranges/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /229-majority-element-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2296-design-a-text-editor/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /23-merge-k-sorted-lists/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /230-kth-smallest-element-in-a-bst/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2300-successful-pairs-of-spells-and-potions/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2301-match-substring-after-replacement/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2302-count-subarrays-with-score-less-than-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2304-minimum-path-cost-in-a-grid/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /231_Power_of_Two.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isPowerOfTwo(self, n): 3 | """ 4 | :type n: int 5 | :rtype: bool 6 | """ 7 | if n < 0: 8 | return False 9 | bin_str = bin(n) 10 | return sum(map(lambda x: int(x), list(bin_str[2:]))) == 1 -------------------------------------------------------------------------------- /232-implement-queue-using-stacks/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2320-count-number-of-ways-to-place-houses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2321-maximum-score-of-spliced-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /234-palindrome-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2348-number-of-zero-filled-subarrays/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /235-lowest-common-ancestor-of-a-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /236-lowest-common-ancestor-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2360-longest-cycle-in-a-graph/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /237-delete-node-in-a-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /238-product-of-array-except-self/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /239-sliding-window-maximum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2409-count-days-spent-together/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /241-different-ways-to-add-parentheses/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2411-smallest-subarrays-with-maximum-bitwise-or/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /242-valid-anagram/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2423-remove-letter-to-equalize-frequency/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2444-count-subarrays-with-fixed-bounds/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2448-minimum-cost-to-make-array-equal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2449-minimum-number-of-operations-to-make-arrays-similar/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2452-words-within-two-edits-of-dictionary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2477-minimum-fuel-cost-to-report-to-the-capital/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2488-count-subarrays-with-median-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2492-minimum-score-of-a-path-between-two-cities/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2498-frog-jump-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /25-reverse-nodes-in-k-group/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2508-add-edges-to-make-degrees-of-all-nodes-even/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2546-apply-bitwise-operations-to-make-strings-equal/2546-apply-bitwise-operations-to-make-strings-equal.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def makeStringsEqual(self, s: str, target: str) -> bool: 3 | return s == target or (int(s) > 0 and int(target) > 0) 4 | -------------------------------------------------------------------------------- /2546-apply-bitwise-operations-to-make-strings-equal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2564-substring-xor-queries/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2565-subsequence-with-the-minimum-score/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /258-add-digits/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /258_Add_Digits.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def addDigits(self, num): 3 | """ 4 | :type num: int 5 | :rtype: int 6 | """ 7 | # https: // en.wikipedia.org / wiki / Digital_root 8 | if num < 10: 9 | return num 10 | return num - ((num - 1) / 9) * 9 -------------------------------------------------------------------------------- /2597-the-number-of-beautiful-subsets/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /26-remove-duplicates-from-sorted-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /2611-mice-and-cheese/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /279-perfect-squares/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /287-find-the-duplicate-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /292_Nim_Game.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def canWinNim(self, n): 3 | """ 4 | :type n: int 5 | :rtype: bool 6 | """ 7 | return n % 4 != 0 -------------------------------------------------------------------------------- /295-find-median-from-data-stream/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /297-serialize-and-deserialize-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /3-longest-substring-without-repeating-characters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /300-longest-increasing-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /309-best-time-to-buy-and-sell-stock-with-cooldown/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /31-next-permutation/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /316-remove-duplicate-letters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /322-coin-change/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /329-longest-increasing-path-in-a-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /33-search-in-rotated-sorted-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /337-house-robber-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /343-integer-break/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /344-reverse-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /344_Reverse_String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseString(self, s): 3 | """ 4 | :type s: str 5 | :rtype: str 6 | """ 7 | # slice 8 | return s[::-1] -------------------------------------------------------------------------------- /347-top-k-frequent-elements/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /349-intersection-of-two-arrays/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /349_Intersection_of_Two_Arrays.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def intersection(self, nums1, nums2): 3 | """ 4 | :type nums1: List[int] 5 | :type nums2: List[int] 6 | :rtype: List[int] 7 | """ 8 | # set 9 | return list(set(nums1) & set(nums2)) -------------------------------------------------------------------------------- /36-valid-sudoku/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /37-sudoku-solver/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /371-sum-of-two-integers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /378-kth-smallest-element-in-a-sorted-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /38-count-and-say/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /386-lexicographical-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /387-first-unique-character-in-a-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /389-find-the-difference/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /39-combination-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /392-is-subsequence/392-is-subsequence.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isSubsequence(self, s: str, t: str) -> bool: 3 | stack = list(s[::-1]) 4 | 5 | for i in t: 6 | if stack and stack[-1] == i: 7 | stack.pop() 8 | 9 | return len(stack) == 0 -------------------------------------------------------------------------------- /392-is-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /394-decode-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /397-integer-replacement/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /4-median-of-two-sorted-arrays/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /40-combination-sum-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /402-remove-k-digits/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /404-sum-of-left-leaves/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /406-queue-reconstruction-by-height/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /409-longest-palindrome/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /416-partition-equal-subset-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /42-trapping-rain-water/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /421-maximum-xor-of-two-numbers-in-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /43-multiply-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /430-flatten-a-multilevel-doubly-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /435-non-overlapping-intervals/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /437-path-sum-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /44-wildcard-matching/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /448-find-all-numbers-disappeared-in-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /45-jump-game-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /452-minimum-number-of-arrows-to-burst-balloons/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /46-permutations/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /461-hamming-distance/461-hamming-distance.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def hammingDistance(self, x: int, y: int) -> int: 3 | a = x ^ y 4 | res = 0 5 | 6 | for i in range(32): 7 | res += a & 1 8 | a = a >> 1 9 | 10 | return res -------------------------------------------------------------------------------- /461-hamming-distance/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /461_Hamming_Distance.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def hammingDistance(self, x, y): 3 | """ 4 | :type x: int 5 | :type y: int 6 | :rtype: int 7 | """ 8 | return bin(x ^ y).count('1') 9 | -------------------------------------------------------------------------------- /47-permutations-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /474-ones-and-zeroes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /48-rotate-image/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /485-max-consecutive-ones/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /493-reverse-pairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /494-target-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /496-next-greater-element-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /5-longest-palindromic-substring/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /50-powx-n/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /51-n-queens/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /516-longest-palindromic-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /518-coin-change-2/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /523-continuous-subarray-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /525-contiguous-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /526-beautiful-arrangement/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /53-maximum-subarray/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /535-encode-and-decode-tinyurl/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /538-convert-bst-to-greater-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /54-spiral-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /540-single-element-in-a-sorted-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /542-01-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /543-diameter-of-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /547-number-of-provinces/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /55-jump-game/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /556-next-greater-element-iii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /557_Reverse_Words_in_a_String_III.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseWords(self, s): 3 | """ 4 | :type s: str 5 | :rtype: str 6 | """ 7 | return ' '.join([word[::-1] for word in s.split(' ')]) 8 | -------------------------------------------------------------------------------- /56-merge-intervals/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /57-insert-interval/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /581-shortest-unsorted-continuous-subarray/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /583-delete-operation-for-two-strings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /589-n-ary-tree-preorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /59-spiral-matrix-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /60-permutation-sequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /61-rotate-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /611-valid-triangle-number/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /617-merge-two-binary-trees/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /62-unique-paths/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /628-maximum-product-of-three-numbers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /63-unique-paths-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /64-minimum-path-sum/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /646-maximum-length-of-pair-chain/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /647-palindromic-substrings/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /652-find-duplicate-subtrees/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /653-two-sum-iv-input-is-a-bst/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /662-maximum-width-of-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /674-longest-continuous-increasing-subsequence/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /677-map-sum-pairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /684-redundant-connection/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /686-repeated-string-match/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /687-longest-univalue-path/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /688-knight-probability-in-chessboard/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /692-top-k-frequent-words/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /695-max-area-of-island/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /70-climbing-stairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /700-search-in-a-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /703-kth-largest-element-in-a-stream/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /71-simplify-path/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /713-subarray-product-less-than-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /714-best-time-to-buy-and-sell-stock-with-transaction-fee/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /72-edit-distance/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /720-longest-word-in-dictionary/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /724-find-pivot-index/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /729-my-calendar-i/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /73-set-matrix-zeroes/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /731-my-calendar-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /733-flood-fill/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /735-asteroid-collision/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /739-daily-temperatures/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /74-search-a-2d-matrix/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /740-delete-and-earn/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /743-network-delay-time/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /746-min-cost-climbing-stairs/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /75-sort-colors/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /76-minimum-window-substring/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /763-partition-labels/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /767-reorganize-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /769-max-chunks-to-make-sorted/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /77-combinations/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /771-jewels-and-stones/771-jewels-and-stones.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def numJewelsInStones(self, jewels: str, stones: str) -> int: 3 | jewels = set(jewels) 4 | res = 0 5 | 6 | for s in stones: 7 | if s in jewels: res += 1 8 | 9 | return res -------------------------------------------------------------------------------- /78-subsets/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /781-rabbits-in-forest/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /785-is-graph-bipartite/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /787-cheapest-flights-within-k-stops/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /79-word-search/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /797-all-paths-from-source-to-target/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /80-remove-duplicates-from-sorted-array-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /801-minimum-swaps-to-make-sequences-increasing/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /814-binary-tree-pruning/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /823-binary-trees-with-factors/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /836-rectangle-overlap/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /84-largest-rectangle-in-histogram/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /841-keys-and-rooms/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /844-backspace-string-compare/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /848-shifting-letters/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /87-scramble-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /876-middle-of-the-linked-list/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /877-stone-game/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /88-merge-sorted-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /881-boats-to-save-people/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /889-construct-binary-tree-from-preorder-and-postorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /90-subsets-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /901-online-stock-span/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /907-sum-of-subarray-minimums/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /909-snakes-and-ladders/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /91-decode-ways/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /912-sort-an-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /92-reverse-linked-list-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /921-minimum-add-to-make-parentheses-valid/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /94-binary-tree-inorder-traversal/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /958-check-completeness-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /96-unique-binary-search-trees/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /961-n-repeated-element-in-size-2n-array/961-n-repeated-element-in-size-2n-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def repeatedNTimes(self, nums: List[int]) -> int: 3 | seen = set() 4 | for i in nums: 5 | if i in seen: return i 6 | else: 7 | seen.add(i) 8 | -------------------------------------------------------------------------------- /962-maximum-width-ramp/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /97-interleaving-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /973-k-closest-points-to-origin/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /974-subarray-sums-divisible-by-k/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /98-validate-binary-search-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /983-minimum-cost-for-tickets/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /987-vertical-order-traversal-of-a-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /993-cousins-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /994-rotting-oranges/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /997-find-the-town-judge/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /Basics-of-Python/01.py: -------------------------------------------------------------------------------- 1 | print("Samir") -------------------------------------------------------------------------------- /Basics-of-Python/03_join.py: -------------------------------------------------------------------------------- 1 | l = ["Camera", "Laptop", "Phone", "ipad", "Hard Disk", "Nvidia Graphic 3080 card"] 2 | 3 | # sentence = "~~".join(l) 4 | # sentence = "==".join(l) 5 | sentence = "\n".join(l) 6 | print(sentence) 7 | print(type(sentence)) -------------------------------------------------------------------------------- /Basics-of-Python/03_raising_exceptions.py: -------------------------------------------------------------------------------- 1 | def increment(num): 2 | try: 3 | return int(num) + 1 4 | except: 5 | raise ValueError("This is not good - Harry") 6 | 7 | a = increment('df364') 8 | print(a) -------------------------------------------------------------------------------- /Basics-of-Python/04_print memory location.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self,data): 3 | self.data = data 4 | self.ref = None 5 | 6 | LL = Node(10) 7 | print(LL) 8 | -------------------------------------------------------------------------------- /Basics-of-Python/05_map.py: -------------------------------------------------------------------------------- 1 | def square(num): 2 | return num*num 3 | 4 | l = [1, 2, 4] 5 | 6 | # Method 1 7 | l2 = [] 8 | for item in l: 9 | l2.append(square(item)) 10 | print(l2) 11 | 12 | # Method 2 13 | print(list(map(square, l))) -------------------------------------------------------------------------------- /Basics-of-Python/07_reduce.py: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | sum = lambda a, b: a+b 4 | 5 | l = [1, 2, 3, 4] 6 | val = reduce(sum, l) 7 | print(val) -------------------------------------------------------------------------------- /Basics-of-Python/15_Delete Any Node By Value in Linked List.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/04_print_list_for.py: -------------------------------------------------------------------------------- 1 | fruits = ['Banana', 'Watermelon', 'Grapes', 'Mangoes'] 2 | 3 | for item in fruits: 4 | print(item) 5 | 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/05_range_function.py: -------------------------------------------------------------------------------- 1 | for i in range(1, 8, 1): 2 | print(i) -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/06_for_with_else.py: -------------------------------------------------------------------------------- 1 | for i in range(10): 2 | print(i) 3 | else: 4 | print("This is inside else of for") -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/07_break_statement.py: -------------------------------------------------------------------------------- 1 | for i in range(10): 2 | print(i) 3 | if i == 5: 4 | break 5 | else: 6 | print("This is inside else of for") -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/09_pass_statement.py: -------------------------------------------------------------------------------- 1 | i = 4 2 | 3 | def run(player): 4 | pass 5 | 6 | def ouch(player): 7 | pass 8 | 9 | if i>0: 10 | pass 11 | 12 | while i>6: 13 | pass 14 | 15 | print("Harry is a good boy") -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/09_pr_05.py: -------------------------------------------------------------------------------- 1 | names = ["harry", "shubham", "rohit", "rohan", "aditi", "shipra"] 2 | name = input("Enter the name to check\n") 3 | 4 | if name in names: 5 | print("Your name is present in the list") 6 | else: 7 | print("Your name is not present in the list") -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/Class Attributes: -------------------------------------------------------------------------------- 1 | Class Employee: 2 | company = “Google” #Specific to each class 3 | harry = Employee() #Object instantiation 4 | harry.company 5 | Employee.company = “YouTube” #changing class attribute 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/Dictionary Methods: -------------------------------------------------------------------------------- 1 | a = {“name”: “Harry”, 2 | “from”: “India”, 3 | “marks”: [92,98,96]} 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/For loop with else (copy): -------------------------------------------------------------------------------- 1 | l = [1, 7, 8] 2 | for item in l: 3 | print(item) 4 | else: 5 | print(“Done”) #This is printed when the loop exhausts! 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/If else and elif in Python (copy): -------------------------------------------------------------------------------- 1 | ''' 2 | if (condition1): // if condition 1 is true 3 | print(“yes”) 4 | elif (condition2): // if condition 2 is true 5 | print(“No”) 6 | else: // otherwise 7 | print(“May be”) 8 | ''' 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/If, elif, else. (copy): -------------------------------------------------------------------------------- 1 | a = 2 2 | if a>0 : 3 | print("Positive") 4 | elif a==-5: 5 | print("-Five") 6 | elif a ==0: 7 | print("Zero") 8 | elif a ==-2: 9 | print("-Two") 10 | else: 11 | print("Negative") 12 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/LexycoGrafic Operators Order (copy): -------------------------------------------------------------------------------- 1 | a = 10>4 2 | print(a) 3 | a = "abc" >"yz" 4 | print(a) 5 | a = "abc" >"ABC" 6 | print(a) 7 | a = ord("A") 8 | print(a) 9 | a = ord("a") 10 | print(a) 11 | a = ord("x") 12 | print(a) 13 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/Py Practice: -------------------------------------------------------------------------------- 1 | a = 1 2 | b = 23 3 | print(a/b) 4 | print(a*b) 5 | print(a-b) 6 | print(a+b) 7 | print(a**b) 8 | print("%0.4f"%(a/b)) 9 | print(a//b) 10 | print(a%b) 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/Table of 5 (copy): -------------------------------------------------------------------------------- 1 | for i in range(1,11): 2 | print(i*5) 3 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/The break statement (copy): -------------------------------------------------------------------------------- 1 | for i in range(0, 80): 2 | print(i) #This will print 0, 1, 2 and 3 3 | if i == 3: 4 | break 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/The continue statement (copy): -------------------------------------------------------------------------------- 1 | for i in range(4): 2 | print(“printing”) 3 | if i == 2: #if i is 2, the iteration is skipped 4 | continue 5 | print(i) 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (3rd copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (4th copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (5th copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (6th copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (7th copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (another copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/To take values from the User (copy): -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/__init__() constructor (copy): -------------------------------------------------------------------------------- 1 | class Employee: 2 | def __init__(self,name): 3 | self.name = name 4 | def getSalary(self): 5 | #Some code… 6 | harry = Employee(“Harry”) #Object can be instantiated using constructor like this! 7 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/converting one data type to another data-type: -------------------------------------------------------------------------------- 1 | a = "225" 2 | a = int(a) 3 | print(type(a)) 4 | 5 | b = 83 6 | b = str(b) 7 | print(type(b)) 8 | 9 | c = 34 10 | c = float(c) 11 | print(type(c)) 12 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/cote to specify strings: -------------------------------------------------------------------------------- 1 | a = '''Samir''' 2 | # a = "Samir" 3 | # a = 'Samir' 4 | b = 343.55 5 | c = 45 6 | print(a) 7 | print(b) 8 | print(c) 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter1.py/elif clause: -------------------------------------------------------------------------------- 1 | ''' 2 | if (condition1): 3 | #code 4 | elif (condition 2): 5 | #code 6 | elif (condition 2): 7 | #code 8 | …. 9 | else: 10 | #code ''' 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/001Conditional_statement_in_python.py: -------------------------------------------------------------------------------- 1 | a = [2,3,4,6,9,23,94,1,353,242,45,24] 2 | 3 | b = set() 4 | c = set() 5 | 6 | 7 | for i in range(0,len(a)): 8 | if(a[i]>10): 9 | b.add(a[i]) 10 | else: 11 | c.add(a[i]) 12 | 13 | print(b) 14 | print(c) 15 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/01_import _os.listdir.py: -------------------------------------------------------------------------------- 1 | # This shows all the fies in the respective folder 2 | import os 3 | print(os.listdir()) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/02.py: -------------------------------------------------------------------------------- 1 | ''' 2 | a = True 3 | b = None 4 | print(type(a)) 5 | print(type(b)) 6 | ''' 7 | a = 3 8 | b = 4 9 | print("The value of 3+4 is ",3+4) 10 | print("The value of 3-4 is ", 3-4) 11 | 12 | a +=20 13 | a -=30 14 | a *=45 15 | a /=39 16 | print("The final value of a is ",a) 17 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Celcious to ferenhite.py: -------------------------------------------------------------------------------- 1 | def ferh(cel): 2 | return (cel*(9/5)) + 32 3 | print(ferh(100)) 4 | 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Check if String Contains Substring.py: -------------------------------------------------------------------------------- 1 | a = "SaMiR is a StuDeNt" 2 | b = a.isupper() 3 | print(b) 4 | 5 | 6 | ''' 7 | if(String.index(SAMIR)): 8 | print("Yes") 9 | else: 10 | print("No") 11 | ''' -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Identifing a spam commet from many words.py: -------------------------------------------------------------------------------- 1 | spam_comments = ["spam","bad","Worst","Not Good","lazy","dog","cat","false"] 2 | 3 | a = input("Write a comment here: \n") 4 | 5 | if(a in spam_comments): 6 | print("It Is A SPAM COMMENT") 7 | else: 8 | print("Good commemt") 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Length_of_a_Password.py: -------------------------------------------------------------------------------- 1 | a = input("Write the password here: \n") 2 | if(len(a)<8): 3 | print("Type a Strong Password with more than 8 charecter") 4 | else: 5 | print("Strong Password") 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Multiplication table in reverse order.py: -------------------------------------------------------------------------------- 1 | n = 5 2 | for i in range(10): 3 | print(f'5 X {10-i} = {n*(10-i)}') 4 | 5 | 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Sample.txt: -------------------------------------------------------------------------------- 1 | Samir is a student. 2 | He lives in Siliguri, Darjeeling, West Bengal 3 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/Sum of first n natual number using for loop.py: -------------------------------------------------------------------------------- 1 | n = int(input("Type a Natural number: \n")) 2 | i = 1 3 | if n>0: 4 | sum = 0 5 | for i in range(1,n+1): 6 | sum = sum + i 7 | print(sum) 8 | else: 9 | print("Type Natural numbers only") 10 | 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/else_optional.py: -------------------------------------------------------------------------------- 1 | a =-332 2 | if(a==7): 3 | print("fanfkjnfkjfn") 4 | elif(a>24): 5 | print("NNNNNNNND") 6 | elif(a<23): 7 | print("WWWWWWWWWw") 8 | elif(a==0): 9 | print("SSSSSSSSSSSSSSSsssSSSSSSss") 10 | #else: 11 | # print("____------____") -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/ends_function.py: -------------------------------------------------------------------------------- 1 | print("Hello",end=" ") 2 | print("there",end=" ") 3 | print("I am",end=" ") 4 | print("Samir",end=" ") 5 | print("Paul",end=" ") 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/files.py: -------------------------------------------------------------------------------- 1 | f = open('Sample.txt') 2 | data = f.read() 3 | print(data) 4 | f.close() 5 | 6 | 7 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/in_Keyword.py: -------------------------------------------------------------------------------- 1 | a = [2,3,2,3,3,2434,3,3533,53,23] 2 | print(34 in a) 3 | print(3 in a) 4 | 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/inch to cm.py: -------------------------------------------------------------------------------- 1 | ''' 2 | n =10 3 | def countup(n): 4 | if n >= 0: 5 | countup(n - 1) 6 | print(n) 7 | 8 | ''' 9 | 10 | n = int(input("Type a number in inch here: ")) 11 | def cem(n): 12 | return n*2.54 13 | print(cem(n)) 14 | 15 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/is_Keyword.py: -------------------------------------------------------------------------------- 1 | a = None 2 | if(a is None): 3 | print("Yes") 4 | else: 5 | print("no") 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/modi.py: -------------------------------------------------------------------------------- 1 | i = 1 2 | for i in range(1,4): 3 | print("MODI + BJP + 👍 VOTE BJP in WEST BENGAL 2021 👍 Election ✔️ ❤️🔥❤️") 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/name-greetings-by-for-loop-and-if-else.py: -------------------------------------------------------------------------------- 1 | l1 = ["Samir Paul","Rohan","Sumit Bagchi","Rahul","Swapan kumar paul","Aniket Samanta"] 2 | 3 | for name in l1: 4 | name.capitalize() 5 | if name.startswith("S"): 6 | print("Hello \t"+ name + " You are selected") 7 | -------------------------------------------------------------------------------- /Basics-of-Python/Chapter2.py/pattern.py: -------------------------------------------------------------------------------- 1 | ''' 2 | * 3 | *** 4 | ***** 5 | ******* 6 | ''' 7 | n = 4 8 | for i in range(n): 9 | print(" "*(n-i-1), end="") 10 | print("*"*(2*i +1), end="") 11 | print(" "*(n-i-1)) 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Basics-of-Python/DSA-problems/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "/usr/bin/python3.9" 3 | } -------------------------------------------------------------------------------- /Basics-of-Python/DSA-problems/01.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/DSA-problems/01.py -------------------------------------------------------------------------------- /Basics-of-Python/For loop with else.py: -------------------------------------------------------------------------------- 1 | l = [1, 7, 8] 2 | for item in l: 3 | print(item) 4 | else: 5 | print(“Done”) #This is printed when the loop exhausts! 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Git_Push_Commands.py: -------------------------------------------------------------------------------- 1 | git status 2 | git add . 3 | git status 4 | git commit -m"-----" 5 | git push 6 | 7 | -------------------------------------------------------------------------------- /Basics-of-Python/If elif else.py: -------------------------------------------------------------------------------- 1 | a = 2 2 | if a>0 : 3 | print("Positive") 4 | elif a==-5: 5 | print("-Five") 6 | elif a ==0: 7 | print("Zero") 8 | elif a ==-2: 9 | print("-Two") 10 | else: 11 | print("Negative") 12 | -------------------------------------------------------------------------------- /Basics-of-Python/If else and elif in Python.py: -------------------------------------------------------------------------------- 1 | ''' 2 | if (condition1): // if condition 1 is true 3 | print(“yes”) 4 | elif (condition2): // if condition 2 is true 5 | print(“No”) 6 | else: // otherwise 7 | print(“May be”) 8 | ''' 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Inheritence+Module/dir/myfunction.py: -------------------------------------------------------------------------------- 1 | def add(a,b): 2 | return a+b 3 | 4 | def multiply(a,b): 5 | return a*b 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Inheritence+Module/rectangle.py: -------------------------------------------------------------------------------- 1 | from Polygon import Polygon 2 | from shape import Shape 3 | 4 | class Rectangle(Polygon,Shape): 5 | def area(self): 6 | return self.get_height()*self.get_width() -------------------------------------------------------------------------------- /Basics-of-Python/Inheritence+Module/shape.py: -------------------------------------------------------------------------------- 1 | class Shape: 2 | __colour = None 3 | 4 | def set_colour(self,colour): 5 | self.__colour = colour 6 | def get_colour(self): 7 | return self.__colour 8 | 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Inheritence+Module/triangle.py: -------------------------------------------------------------------------------- 1 | from Polygon import Polygon 2 | from shape import Shape 3 | class Triangle(Polygon,Shape): 4 | def area(self): 5 | return (self.get_width()*self.get_height())/2 6 | 7 | -------------------------------------------------------------------------------- /Basics-of-Python/LexycoGrafic Operators Order.py: -------------------------------------------------------------------------------- 1 | a = 10>4 2 | print(a) 3 | a = "abc" >"yz" 4 | print(a) 5 | a = "abc" >"ABC" 6 | print(a) 7 | a = ord("A") 8 | print(a) 9 | a = ord("a") 10 | print(a) 11 | a = ord("x") 12 | print(a) 13 | -------------------------------------------------------------------------------- /Basics-of-Python/LinkedList/Doubly Linked List/Circular Linked List .py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/LinkedList/Doubly Linked List/Circular Linked List .py -------------------------------------------------------------------------------- /Basics-of-Python/LinkedList/Singly Linked List/04_print memory location.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self,data): 3 | self.data = data 4 | self.ref = None 5 | 6 | LL = Node(10) 7 | print(LL) 8 | -------------------------------------------------------------------------------- /Basics-of-Python/LinkedList/Singly Linked List/16_Doubly Linked List.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/LinkedList/Singly Linked List/16_Doubly Linked List.py -------------------------------------------------------------------------------- /Basics-of-Python/Modules/01.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/Modules/01.py -------------------------------------------------------------------------------- /Basics-of-Python/Modules/dir/myfunction.py: -------------------------------------------------------------------------------- 1 | def add(a,b): 2 | return a+b 3 | 4 | def multiply(a,b): 5 | return a*b 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Modules/rectangle.py: -------------------------------------------------------------------------------- 1 | from Polygon import Polygon 2 | from shape import Shape 3 | 4 | class Rectangle(Polygon,Shape): 5 | def area(self): 6 | return self.get_height()*self.get_width() -------------------------------------------------------------------------------- /Basics-of-Python/Modules/shape.py: -------------------------------------------------------------------------------- 1 | class Shape: 2 | __colour = None 3 | 4 | def set_colour(self,colour): 5 | self.__colour = colour 6 | def get_colour(self): 7 | return self.__colour 8 | 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Modules/triangle.py: -------------------------------------------------------------------------------- 1 | from Polygon import Polygon 2 | from shape import Shape 3 | class Triangle(Polygon,Shape): 4 | def area(self): 5 | return (self.get_width()*self.get_height())/2 6 | 7 | -------------------------------------------------------------------------------- /Basics-of-Python/My First Python Code.py: -------------------------------------------------------------------------------- 1 | # I am writing comments: 2 | ''' 3 | Hello 4 | Samir Paul 5 | SAGAR 6 | ''' 7 | print("Hello") 8 | print("Samir Paul") 9 | print("Sagar Paul") 10 | print("SAGAR") 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Object_Oriented_Programming/03.py: -------------------------------------------------------------------------------- 1 | class Animal: 2 | name = "dog" 3 | def color(self, colourName): 4 | print(self.name," is ",colourName) 5 | 6 | 7 | 8 | animal = Animal() 9 | animal.color("black") -------------------------------------------------------------------------------- /Basics-of-Python/Object_Oriented_Programming/2-D array.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | arr1 = ([ 4 | [1,2,3], 5 | [4,5,6], 6 | [7,8,9] 7 | 8 | 9 | ]) 10 | 11 | print(arr1) 12 | -------------------------------------------------------------------------------- /Basics-of-Python/Operatos and expressions.py: -------------------------------------------------------------------------------- 1 | a= 10+10 2 | a= 1-20 3 | a= 2*5 4 | a= 10**5 5 | a= 10/2 6 | a= 10%3 7 | a= 10/3000 8 | 9 | print(a) 10 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/01.py: -------------------------------------------------------------------------------- 1 | st = "Samir was the king of India" 2 | doublespaces = st.find(" ") 3 | print(doublespaces) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/02.py: -------------------------------------------------------------------------------- 1 | sam = "Samir Paul is The Best" 2 | sam = sam.replace(" "," _#_ ") 3 | print(sam) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/02_if_else_quick_quiz.py: -------------------------------------------------------------------------------- 1 | age = int(input("Enter your age: ")) 2 | 3 | if age>18: 4 | print("Yes") 5 | else: 6 | print("No") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/03.py: -------------------------------------------------------------------------------- 1 | letter = "Dear Samir Paul,\n\tThanks for helping me\ndate 16-Feb-2021" 2 | print(letter) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/03_logical_and_relational_operators.py: -------------------------------------------------------------------------------- 1 | age = int(input("Enter your age: ")) 2 | if(age>34 or age<56): 3 | print("You can work with us") 4 | 5 | else: 6 | print("You cannot work with us") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/04.py: -------------------------------------------------------------------------------- 1 | a = [2,3,4,56,7,6] 2 | print(a) 3 | print(a[3]) 4 | print(a[4]) 5 | 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/04_in_and_is.py: -------------------------------------------------------------------------------- 1 | # a = None 2 | # if (a is None): 3 | # print("Yes") 4 | # else: 5 | # print("No") 6 | 7 | a = [45, 56, 6] 8 | print(435 in a) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/04_print_list_for.py: -------------------------------------------------------------------------------- 1 | fruits = ['Banana', 'Watermelon', 'Grapes', 'Mangoes'] 2 | 3 | for item in fruits: 4 | print(item) 5 | 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/04_try_with_else.py: -------------------------------------------------------------------------------- 1 | try: 2 | i = int(input("Enter a number: ")) 3 | c = 1/i 4 | except Exception as e: 5 | print(e) 6 | else: 7 | print("We were successful") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/05_is_else_optional.py: -------------------------------------------------------------------------------- 1 | a = 6 2 | if(a==7): 3 | print("yes") 4 | elif(a>56): 5 | print("no and yes") 6 | else: 7 | print("I am optional") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/05_try_except_finally (copy).py: -------------------------------------------------------------------------------- 1 | try: 2 | i = int(input("Enter a number: ")) 3 | c = 1/i 4 | except Exception as e: 5 | print(e) 6 | exit() 7 | finally: 8 | print("We are done") 9 | 10 | print("Thanks for using the program") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/05_try_except_finally.py: -------------------------------------------------------------------------------- 1 | try: 2 | i = int(input("Enter a number: ")) 3 | c = 1/i 4 | except Exception as e: 5 | print(e) 6 | exit() 7 | finally: 8 | print("We are done") 9 | 10 | print("Thanks for using the program") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/06_self.py: -------------------------------------------------------------------------------- 1 | class Employee: 2 | company = "Google" 3 | def getSalary(self): 4 | print(f"Salary for this employee working in {self.company} is {self.salary}") 5 | 6 | harry = Employee() 7 | harry.salary = 100000 8 | harry.getSalary() # Employee.getSalary(harry) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/06_tuples.py: -------------------------------------------------------------------------------- 1 | # make a tuple with () 2 | t = (1,2,5,67,2,1,111,1) 3 | print(t.count(2)) 4 | 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/08_continue_statement.py: -------------------------------------------------------------------------------- 1 | for i in range(10): 2 | if i == 5: 3 | continue 4 | print(i) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/08_global.py: -------------------------------------------------------------------------------- 1 | a = 54 # Global variable 2 | def func1(): 3 | global a 4 | print(f"Print statement 1: {a}") 5 | a = 8 # Local Variable if global keyword is not used 6 | print(f"Print statement 2: {a}") 7 | 8 | func1() 9 | print(f"Print statement 3: {a}") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_05_pr_01.py: -------------------------------------------------------------------------------- 1 | f = open('poems.txt') 2 | t = f.read() 3 | if 'twinkle' in t: 4 | print("Twinkle is present") 5 | else: 6 | print("Twinkle is not present") 7 | f.close() -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_07_pr_03.py: -------------------------------------------------------------------------------- 1 | 2 | for i in range(2, 21): 3 | with open(f"tables/Multiplication_table_of_{i}.txt", 'w') as f: 4 | for j in range(1, 11): 5 | f.write(f"{i}X{j}={i*j}") 6 | if j!=10: 7 | f.write('\n') 8 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_08_pr_04.py: -------------------------------------------------------------------------------- 1 | with open("sample.txt") as f: 2 | content = f.read() 3 | 4 | content = content.replace("donkey", "$%^@$^#") 5 | 6 | with open("sample.txt", "w") as f: 7 | f.write(content) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_09_pr_05.py: -------------------------------------------------------------------------------- 1 | words = ["donkey", "kaddu", "mote"] 2 | 3 | with open("sample.txt") as f: 4 | content = f.read() 5 | 6 | 7 | for word in words: 8 | content = content.replace(word, "$%^@$^#") 9 | with open("sample.txt", "w") as f: 10 | f.write(content) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_enumerate.py: -------------------------------------------------------------------------------- 1 | list1 = [3, 53, 2, False, 6.2, "Harry"] 2 | 3 | # index = 0 4 | # for item in list1: 5 | # print(item, index) 6 | # index += 1 7 | 8 | for index, item in enumerate(list1): 9 | print(item, index) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_pr_05.py: -------------------------------------------------------------------------------- 1 | names = ["harry", "shubham", "rohit", "rohan", "aditi", "shipra"] 2 | name = input("Enter the name to check\n") 3 | 4 | if name in names: 5 | print("Your name is present in the list") 6 | else: 7 | print("Your name is not present in the list") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/09_sum_of_list.py: -------------------------------------------------------------------------------- 1 | a = [3,45,65,24,66,2,65] 2 | print(sum(a)) 3 | # print(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/10_pr_04.py: -------------------------------------------------------------------------------- 1 | l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 54, 23, 55, 90, 60] 2 | 3 | a = filter(lambda a: a%5==0, l) 4 | print(list(a)) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/14.py: -------------------------------------------------------------------------------- 1 | 2 | ints = [1, 2, 88, -100, 49] 3 | total = 0 4 | for i in range(len(ints)): 5 | total = total + ints[i] 6 | if total < 0: 7 | break 8 | print (ints[i]) 9 | 10 | 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/15_check prime no.py: -------------------------------------------------------------------------------- 1 | def count_recursive(n=1): 2 | if n > 3: 3 | return: 4 | print(n) 5 | count_recursive(n + 1) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/18_use of Strip_Function.py: -------------------------------------------------------------------------------- 1 | a = input("Write the number here:\n ") 2 | if a.strip() == "yes": 3 | print("True") 4 | 5 | else: 6 | print("False") 7 | 8 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/19.py: -------------------------------------------------------------------------------- 1 | string='I study Python at Coding Blocks' 2 | print(string[0:9:2]) 3 | 4 | 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/20_Sets_.py: -------------------------------------------------------------------------------- 1 | a = {21,23,5,56,1,35,2,1,4,1,2,3,5} 2 | print(type(a)) 3 | print(a) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/21.py: -------------------------------------------------------------------------------- 1 | a = set() 2 | a.add(3) 3 | a.add(4) 4 | a.add(5) 5 | a.add(6) 6 | a.add(10) 7 | # a.add((2,3,4,5,,6,7)) # can not add a tuple to a set 8 | # a.add({2,3,4,5,6,7}) # can not add to a set >> unhasheble 9 | # a.add([1,2,3,4,5,6,7,8]) # can not add 10 | print(a) 11 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/22properties of sets.py: -------------------------------------------------------------------------------- 1 | a = set() # an Empty set 2 | # we are adding values into the empty set 3 | a.add(3) 4 | a.add(4) 5 | a.add(5) 6 | a.add(6) 7 | a.add(10) 8 | a.remove(6) 9 | 10 | print(len(a)) 11 | print(a) 12 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/24Dictionary of Hindi to English.py: -------------------------------------------------------------------------------- 1 | myDict = { 2 | "per":"Tree", 3 | "insan": "human", 4 | "kitab":"book", 5 | "pila":"yellow" 6 | } 7 | a = input("Write the word here:\n ") 8 | print("The meaning of the word is: ",myDict[a]) 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/25_instance_.py: -------------------------------------------------------------------------------- 1 | # a = 23 2 | a = "Samir" 3 | print(type(a)) 4 | # now check wheather evrything in Python is Objet oriyented or not 5 | print(isinstance(a,object)) 6 | 7 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/27.py: -------------------------------------------------------------------------------- 1 | # Set also prints int with String 2 | s = {2,3,4,5,5,5,5,"SamirPaul1"} 3 | print(s) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/28.py: -------------------------------------------------------------------------------- 1 | s = {2,2.00,4,"2",6} 2 | print(len(s)) # --->> it count 2 and 2.00 same -------------------------------------------------------------------------------- /Basics-of-Python/Practice/29.py: -------------------------------------------------------------------------------- 1 | s = {} 2 | a = type(s) 3 | print(a) -------------------------------------------------------------------------------- /Basics-of-Python/Practice/32.py: -------------------------------------------------------------------------------- 1 | a = "Welcome to 30 Days of Code!" 2 | if a.strip() == "Welcome to 30 Days of Code!" : 3 | print('''Hello, World. 4 | Welcome to 30 Days of Code!''') 5 | else: 6 | print("Nothing to show") -------------------------------------------------------------------------------- /Basics-of-Python/Practice/33.py: -------------------------------------------------------------------------------- 1 | print('''Samir Paul is the best guy in the world. 2 | He will be the King of the world''') 3 | print("He is the best Python coder in the world") 4 | print("# I Am The Bast") 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/34.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/Practice/34.py -------------------------------------------------------------------------------- /Basics-of-Python/Practice/Data-Stractures/04_print memory location.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self,data): 3 | self.data = data 4 | self.ref = None 5 | 6 | LL = Node(10) 7 | print(LL) 8 | -------------------------------------------------------------------------------- /Basics-of-Python/Practice/Data-Stractures/15_Delete Any Node By Value in Linked List.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/02.py: -------------------------------------------------------------------------------- 1 | a = "Hello World!" 2 | def reverse(a): 3 | s = "" 4 | for i in a: 5 | s = i + s 6 | return s 7 | 8 | print(reverse(a)) 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/03.py: -------------------------------------------------------------------------------- 1 | nums = [2,7,11,15] 2 | # target = 9 3 | # output = [0,1] 4 | i = 0 5 | while i <= len(nums): 6 | if nums[i] + nums[i+1] == 9: 7 | print([i, i+1]) 8 | break 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/04.py: -------------------------------------------------------------------------------- 1 | import collections 2 | q = collections.deque() 3 | print(not q) 4 | q.append(10) 5 | q.append(20) 6 | q.append(30) 7 | q.append(40) 8 | q.append(50) 9 | print(q) 10 | 11 | 12 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/05.py: -------------------------------------------------------------------------------- 1 | n = ["a","b","a","b","a","a"] 2 | l = len(n) 3 | 4 | m = [] 5 | 6 | i = 0 7 | for i in range(int(l/2)): 8 | m.append(n[int(l/2) + i]) 9 | 10 | j = 0 11 | for j in range(int(l/2)): 12 | m.append(n[j]) 13 | 14 | print(m) # ['b', 'a', 'a', 'a', 'b', 'a'] 15 | 16 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/06.py: -------------------------------------------------------------------------------- 1 | n = ["a","b","a","b","a","a"] 2 | 3 | l = int(len(n)) 4 | 5 | for i in range(l-1): 6 | if n[i] == n[i+1]: 7 | l1 = n.remove(n[i]) 8 | print(l1) 9 | 10 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/07.py: -------------------------------------------------------------------------------- 1 | class BST: 2 | def __init__(self,key): 3 | self.key = key 4 | self.lchild = None 5 | self.rchild = None 6 | 7 | root = BST(10) 8 | print(root.key) 9 | print(root.lchild) 10 | print(root.rchild) 11 | 12 | 13 | -------------------------------------------------------------------------------- /Basics-of-Python/Queue Data-Stracture/Trick to reverse a string in python.py: -------------------------------------------------------------------------------- 1 | # Trick to reverse a string in python: 2 | 3 | a = "Hello, I am Samir Paul" 4 | print(a[::-1]) 5 | -------------------------------------------------------------------------------- /Basics-of-Python/Recursion.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | if i == 0 or i == 1 : #Base condition which doesn’t call the function any further 3 | return i 4 | else: 5 | return n*factorial(n-1) #Function calling itself 6 | -------------------------------------------------------------------------------- /Basics-of-Python/Static method.py: -------------------------------------------------------------------------------- 1 | class Employee: 2 | company = “Google” 3 | def getSalary(self): 4 | print(“Salary is not there”) 5 | 6 | @staticmethod #decorator to mark greet as a static method 7 | def greet(): 8 | print(“Hello user”) 9 | -------------------------------------------------------------------------------- /Basics-of-Python/Syntax.py: -------------------------------------------------------------------------------- 1 | ''' a = {“key”: “value”, 2 | “harry”: “code”, 3 | “marks” : “100”, 4 | “list”: [1,2,9]} 5 | a[“key”] # Prints value 6 | a[“list”] # Prints [1,2,9] ''' 7 | -------------------------------------------------------------------------------- /Basics-of-Python/Table of 5.py: -------------------------------------------------------------------------------- 1 | for i in range(1,11): 2 | print(i*5) 3 | -------------------------------------------------------------------------------- /Basics-of-Python/The break statement.py: -------------------------------------------------------------------------------- 1 | for i in range(0, 80): 2 | print(i) #This will print 0, 1, 2 and 3 3 | if i == 3: 4 | break 5 | -------------------------------------------------------------------------------- /Basics-of-Python/The continue statement.py: -------------------------------------------------------------------------------- 1 | for i in range(4): 2 | print(“printing”) 3 | if i == 2: #if i is 2, the iteration is skipped 4 | continue 5 | print(i) 6 | -------------------------------------------------------------------------------- /Basics-of-Python/To take values from the User.py: -------------------------------------------------------------------------------- 1 | a = input("type value of number a here: ") 2 | b = input("type value of number b here: ") 3 | print("The sum of numbers a and b is: ", a+b) 4 | -------------------------------------------------------------------------------- /Basics-of-Python/Trick to reverse a string in python.py: -------------------------------------------------------------------------------- 1 | # Trick to reverse a string in python: 2 | 3 | a = "Hello, I am Samir Paul" 4 | print(a[::-1]) 5 | -------------------------------------------------------------------------------- /Basics-of-Python/__init__ constructor.py: -------------------------------------------------------------------------------- 1 | class Employee: 2 | def __init__(self,name): 3 | self.name = name 4 | def getSalary(self): 5 | #Some code… 6 | harry = Employee(“Harry”) #Object can be instantiated using constructor like this! 7 | -------------------------------------------------------------------------------- /Basics-of-Python/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/Highscore.txt: -------------------------------------------------------------------------------- 1 | 123 -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/New_File.txt: -------------------------------------------------------------------------------- 1 | PyThOn 2 | Samir 3 | I am The Best 4 | best course to learn programming 5 | Thanks 6 | PytHoN 7 | vmaekeraa 8 | emwkfm krrrrrrrrrr kkkkee mrknq qjhijv orhrv riuqogj oijog 9 | vvkgn pYthoN knejfwn 10 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/append.py: -------------------------------------------------------------------------------- 1 | f = open('text.txt','a') 2 | f.write("\nHELLO Bhai Kaha ho abhi") 3 | f.close -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/comment.txt: -------------------------------------------------------------------------------- 1 | @#$%@ @#$%@ , asad, ewrw 2 | safe 3 | @#$%@, adw,erw 4 | @#$%@ 5 | good 6 | best @#$%@ 7 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/file reading.py: -------------------------------------------------------------------------------- 1 | 2 | #f = open('text.txt', 'r') 3 | f = open('text.txt') # by default the mode si r that is read mode if it is a text file 4 | data = f.read() 5 | # data = f.read(10) 6 | print(data) 7 | f.close() 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/log.txt: -------------------------------------------------------------------------------- 1 | PyThOn 2 | Samir 3 | I am The Best 4 | best course to learn programming 5 | Thanks 6 | PytHoN 7 | vmaekeraa 8 | emwkfm krrrrrrrrrr kkkkee mrknq qjhijv orhrv riuqogj oijog 9 | vvkgn pYthoN knejfwn 10 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/multiplication table 2 to 20 in different files by for loop/ZIP_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/chapter3 .py/multiplication table 2 to 20 in different files by for loop/ZIP_1.png -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/multiplication table 2 to 20 in different files by for loop/python.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/Basics-of-Python/chapter3 .py/multiplication table 2 to 20 in different files by for loop/python.gif -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/poem.txt: -------------------------------------------------------------------------------- 1 | twinkle twinkle little star how are wonder what you are! -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/rewrite_bad_words_from_a_file.py: -------------------------------------------------------------------------------- 1 | words = ['donkey','kaddu','bad','worst','mote'] 2 | 3 | with open('comment.txt','r') as f: 4 | a = f.read() 5 | 6 | for word in words: 7 | a = a.replace(word,"@#$%@") 8 | with open('comment.txt','w') as f: 9 | f.write(a) 10 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/samir.py: -------------------------------------------------------------------------------- 1 | import os 2 | oldname = "siliguri.txt" 3 | newname = "New_File.txt" 4 | with open('siliguri.txt','r') as f: 5 | a = f.read() 6 | 7 | with open('New_File.txt','w') as f: 8 | f.write(a) 9 | 10 | os.remove(oldname) -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/sample.txt: -------------------------------------------------------------------------------- 1 | hello world ! 2 | 23333333333333333333333333333 3 | 23333333333333333333333333333 4 | 23333333333333333333333333333 -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_1.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 1 is Written below: 2 | 1 X 1 = 1 3 | 1 X 2 = 2 4 | 1 X 3 = 3 5 | 1 X 4 = 4 6 | 1 X 5 = 5 7 | 1 X 6 = 6 8 | 1 X 7 = 7 9 | 1 X 8 = 8 10 | 1 X 9 = 9 11 | 1 X 10 = 10 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_10.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 10 is Written below: 2 | 10 X 1 = 10 3 | 10 X 2 = 20 4 | 10 X 3 = 30 5 | 10 X 4 = 40 6 | 10 X 5 = 50 7 | 10 X 6 = 60 8 | 10 X 7 = 70 9 | 10 X 8 = 80 10 | 10 X 9 = 90 11 | 10 X 10 = 100 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_11.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 11 is Written below: 2 | 11 X 1 = 11 3 | 11 X 2 = 22 4 | 11 X 3 = 33 5 | 11 X 4 = 44 6 | 11 X 5 = 55 7 | 11 X 6 = 66 8 | 11 X 7 = 77 9 | 11 X 8 = 88 10 | 11 X 9 = 99 11 | 11 X 10 = 110 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_12.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 12 is Written below: 2 | 12 X 1 = 12 3 | 12 X 2 = 24 4 | 12 X 3 = 36 5 | 12 X 4 = 48 6 | 12 X 5 = 60 7 | 12 X 6 = 72 8 | 12 X 7 = 84 9 | 12 X 8 = 96 10 | 12 X 9 = 108 11 | 12 X 10 = 120 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_13.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 13 is Written below: 2 | 13 X 1 = 13 3 | 13 X 2 = 26 4 | 13 X 3 = 39 5 | 13 X 4 = 52 6 | 13 X 5 = 65 7 | 13 X 6 = 78 8 | 13 X 7 = 91 9 | 13 X 8 = 104 10 | 13 X 9 = 117 11 | 13 X 10 = 130 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_14.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 14 is Written below: 2 | 14 X 1 = 14 3 | 14 X 2 = 28 4 | 14 X 3 = 42 5 | 14 X 4 = 56 6 | 14 X 5 = 70 7 | 14 X 6 = 84 8 | 14 X 7 = 98 9 | 14 X 8 = 112 10 | 14 X 9 = 126 11 | 14 X 10 = 140 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_15.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 15 is Written below: 2 | 15 X 1 = 15 3 | 15 X 2 = 30 4 | 15 X 3 = 45 5 | 15 X 4 = 60 6 | 15 X 5 = 75 7 | 15 X 6 = 90 8 | 15 X 7 = 105 9 | 15 X 8 = 120 10 | 15 X 9 = 135 11 | 15 X 10 = 150 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_16.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 16 is Written below: 2 | 16 X 1 = 16 3 | 16 X 2 = 32 4 | 16 X 3 = 48 5 | 16 X 4 = 64 6 | 16 X 5 = 80 7 | 16 X 6 = 96 8 | 16 X 7 = 112 9 | 16 X 8 = 128 10 | 16 X 9 = 144 11 | 16 X 10 = 160 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_17.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 17 is Written below: 2 | 17 X 1 = 17 3 | 17 X 2 = 34 4 | 17 X 3 = 51 5 | 17 X 4 = 68 6 | 17 X 5 = 85 7 | 17 X 6 = 102 8 | 17 X 7 = 119 9 | 17 X 8 = 136 10 | 17 X 9 = 153 11 | 17 X 10 = 170 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_18.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 18 is Written below: 2 | 18 X 1 = 18 3 | 18 X 2 = 36 4 | 18 X 3 = 54 5 | 18 X 4 = 72 6 | 18 X 5 = 90 7 | 18 X 6 = 108 8 | 18 X 7 = 126 9 | 18 X 8 = 144 10 | 18 X 9 = 162 11 | 18 X 10 = 180 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_19.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 19 is Written below: 2 | 19 X 1 = 19 3 | 19 X 2 = 38 4 | 19 X 3 = 57 5 | 19 X 4 = 76 6 | 19 X 5 = 95 7 | 19 X 6 = 114 8 | 19 X 7 = 133 9 | 19 X 8 = 152 10 | 19 X 9 = 171 11 | 19 X 10 = 190 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_2.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 2 is Written below: 2 | 2 X 1 = 2 3 | 2 X 2 = 4 4 | 2 X 3 = 6 5 | 2 X 4 = 8 6 | 2 X 5 = 10 7 | 2 X 6 = 12 8 | 2 X 7 = 14 9 | 2 X 8 = 16 10 | 2 X 9 = 18 11 | 2 X 10 = 20 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_20.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 20 is Written below: 2 | 20 X 1 = 20 3 | 20 X 2 = 40 4 | 20 X 3 = 60 5 | 20 X 4 = 80 6 | 20 X 5 = 100 7 | 20 X 6 = 120 8 | 20 X 7 = 140 9 | 20 X 8 = 160 10 | 20 X 9 = 180 11 | 20 X 10 = 200 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_3.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 3 is Written below: 2 | 3 X 1 = 3 3 | 3 X 2 = 6 4 | 3 X 3 = 9 5 | 3 X 4 = 12 6 | 3 X 5 = 15 7 | 3 X 6 = 18 8 | 3 X 7 = 21 9 | 3 X 8 = 24 10 | 3 X 9 = 27 11 | 3 X 10 = 30 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_4.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 4 is Written below: 2 | 4 X 1 = 4 3 | 4 X 2 = 8 4 | 4 X 3 = 12 5 | 4 X 4 = 16 6 | 4 X 5 = 20 7 | 4 X 6 = 24 8 | 4 X 7 = 28 9 | 4 X 8 = 32 10 | 4 X 9 = 36 11 | 4 X 10 = 40 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_5.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 5 is Written below: 2 | 5 X 1 = 5 3 | 5 X 2 = 10 4 | 5 X 3 = 15 5 | 5 X 4 = 20 6 | 5 X 5 = 25 7 | 5 X 6 = 30 8 | 5 X 7 = 35 9 | 5 X 8 = 40 10 | 5 X 9 = 45 11 | 5 X 10 = 50 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_6.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 6 is Written below: 2 | 6 X 1 = 6 3 | 6 X 2 = 12 4 | 6 X 3 = 18 5 | 6 X 4 = 24 6 | 6 X 5 = 30 7 | 6 X 6 = 36 8 | 6 X 7 = 42 9 | 6 X 8 = 48 10 | 6 X 9 = 54 11 | 6 X 10 = 60 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_7.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 7 is Written below: 2 | 7 X 1 = 7 3 | 7 X 2 = 14 4 | 7 X 3 = 21 5 | 7 X 4 = 28 6 | 7 X 5 = 35 7 | 7 X 6 = 42 8 | 7 X 7 = 49 9 | 7 X 8 = 56 10 | 7 X 9 = 63 11 | 7 X 10 = 70 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_8.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 8 is Written below: 2 | 8 X 1 = 8 3 | 8 X 2 = 16 4 | 8 X 3 = 24 5 | 8 X 4 = 32 6 | 8 X 5 = 40 7 | 8 X 6 = 48 8 | 8 X 7 = 56 9 | 8 X 8 = 64 10 | 8 X 9 = 72 11 | 8 X 10 = 80 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/table_of_9.txt: -------------------------------------------------------------------------------- 1 | The Multiplication Table of 9 is Written below: 2 | 9 X 1 = 9 3 | 9 X 2 = 18 4 | 9 X 3 = 27 5 | 9 X 4 = 36 6 | 9 X 5 = 45 7 | 9 X 6 = 54 8 | 9 X 7 = 63 9 | 9 X 8 = 72 10 | 9 X 9 = 81 11 | 9 X 10 = 90 12 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/this.txt: -------------------------------------------------------------------------------- 1 | PyThOn 2 | Samir 3 | I am The Best 4 | best course to learn programming 5 | Thanks 6 | PytHoN 7 | vmaekeraa 8 | emwkfm krrrrrrrrrr kkkkee mrknq qjhijv orhrv riuqogj oijog 9 | vvkgn pYthoN knejfwn 10 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/with statement.py: -------------------------------------------------------------------------------- 1 | with open('sample.txt', 'a') as file: 2 | file.write("\n 23333333333333333333333333333") 3 | 4 | with open('text.txt','r') as f: 5 | a = f.read() 6 | print(a) 7 | 8 | -------------------------------------------------------------------------------- /Basics-of-Python/chapter3 .py/write a file.py: -------------------------------------------------------------------------------- 1 | f = open('sample.txt','w') 2 | f.write("I am Samir Paul") 3 | 4 | f.close 5 | -------------------------------------------------------------------------------- /BingSiteAuth.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1A92FC2EC113F8616A21D76DA684A133 4 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/__init__.py -------------------------------------------------------------------------------- /ads.txt: -------------------------------------------------------------------------------- 1 | google.com, pub-8274401353019049, DIRECT, f08c47fec0942fa0 -------------------------------------------------------------------------------- /assets/long-banner-breck-img-readme-unnamed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamirPaulb/LeetCode/2f13d394eded882c1d66ea95b929bd3e6682d7c7/assets/long-banner-breck-img-readme-unnamed.png -------------------------------------------------------------------------------- /leetcode-cpp/1048-longest-string-chain/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1146-snapshot-array/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/121-best-time-to-buy-and-sell-stock/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1219-path-with-maximum-gold/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1291-sequential-digits/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1297-maximum-number-of-occurrences-of-a-substring/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1305-all-elements-in-two-binary-search-trees/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1367-linked-list-in-binary-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1371-find-the-longest-substring-containing-vowels-in-even-counts/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/1672-richest-customer-wealth/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/438-find-all-anagrams-in-a-string/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/454-4sum-ii/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/486-predict-the-winner/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/638-shopping-offers/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/684-redundant-connection/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/834-sum-of-distances-in-tree/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/849-maximize-distance-to-closest-person/NOTES.md: -------------------------------------------------------------------------------- 1 | ​ -------------------------------------------------------------------------------- /leetcode-cpp/README.md: -------------------------------------------------------------------------------- 1 | # LeetCode 2 | Collection of LeetCode questions to ace the coding interview! 3 | -------------------------------------------------------------------------------- /leetcode-cpp/delete-duplicate-emails/delete-duplicate-emails.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | DELETE P1 3 | FROM PERSON P1, PERSON P2 4 | WHERE P1.EMAIL=P2.EMAIL AND P1.ID>P2.ID; -------------------------------------------------------------------------------- /leetcode-cpp/department-highest-salary/department-highest-salary.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select d.name as 'Department',E.NAME AS 'Employee',e.salary 3 | from department d,employee e 4 | where d.id = e.departmentId 5 | and e.salary = (select max(e1.salary) from employee e1 where e1.departmentId = d.id) -------------------------------------------------------------------------------- /leetcode-cpp/employees-earning-more-than-their-managers/employees-earning-more-than-their-managers.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT a.NAME as Employee FROM EMPLOYEE as a, EMPLOYEE as b WHERE a.ManagerId=b.Id and a.SALARY>b.salary; -------------------------------------------------------------------------------- /leetcode-cpp/number-of-1-bits/number-of-1-bits.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int hammingWeight(uint32_t n) { 4 | return __builtin_popcount(n); 5 | } 6 | }; -------------------------------------------------------------------------------- /leetcode-cpp/power-of-four/power-of-four.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | bool isPowerOfFour(int n) { 4 | for(int i=0;i<32;i+=2){ 5 | if(n==(1<>1; 8 |            pow-=1; 9 |       } 10 |        return ans; 11 |   } 12 | }; 13 | -------------------------------------------------------------------------------- /leetcode-cpp/single-number/single-number.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int singleNumber(vector& nums) { 4 | int ans=0; 5 | for(auto i: nums) 6 | ans^=i; 7 | return ans; 8 | } 9 | }; -------------------------------------------------------------------------------- /problems/array_partition/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def arrayPairSum(self, nums: List[int]) -> int: 3 | nums.sort() 4 | ans = 0 5 | i = 0 6 | while i < len(nums)-1: 7 | ans += min(nums[i], nums[i+1]) 8 | i += 2 9 | return ans -------------------------------------------------------------------------------- /problems/best_time_to_buy_and_sell_stock_ii/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProfit(self, prices: List[int]) -> int: 3 | res = 0 4 | for i in range(len(prices) - 1): 5 | if prices[i + 1] > prices[i]: 6 | res += prices[i + 1] - prices[i] 7 | 8 | return res -------------------------------------------------------------------------------- /problems/check_if_the_sentence_is_pangram/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def checkIfPangram(self, sentence: str) -> bool: 3 | return len(set(sentence)) ==26 4 | -------------------------------------------------------------------------------- /problems/contains_duplicate/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def containsDuplicate(self, nums: List[int]) -> bool: 3 | arr_len = len(nums) 4 | set_len = len(set(nums)) 5 | 6 | return arr_len != set_len 7 | -------------------------------------------------------------------------------- /problems/count_negative_numbers_in_a_sorted_matrix/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def countNegatives(self, grid: List[List[int]]) -> int: 3 | return str(grid).count('-') -------------------------------------------------------------------------------- /problems/counting_bits/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def countBits(self, n: int) -> List[int]: 3 | 4 | ans = [] 5 | for i in range(n+1): 6 | ans.append(bin(i).count('1')) 7 | return ans -------------------------------------------------------------------------------- /problems/defanging_an_ip_address/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def defangIPaddr(self, address: str) -> str: 3 | address = str(address) 4 | address = address.replace(".","[.]") 5 | return address 6 | 7 | 8 | -------------------------------------------------------------------------------- /problems/egg_drop_with_2_eggs_and_n_floors/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def twoEggDrop(self, n: int) -> int: 3 | c = 0 4 | i = 0 5 | while i < n: 6 | c += 1 7 | i += c 8 | return c 9 | 10 | 11 | -------------------------------------------------------------------------------- /problems/factorial_trailing_zeroes/solution.py: -------------------------------------------------------------------------------- 1 | import math 2 | class Solution: 3 | def trailingZeroes(self, n: int) -> int: 4 | ans = 0 5 | while n != 0: 6 | n //= 5 7 | ans += n 8 | 9 | return ans -------------------------------------------------------------------------------- /problems/fair_candy_swap/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def fairCandySwap(self, A, B): 3 | dif = (sum(A) - sum(B)) / 2 4 | A = set(A) 5 | for b in set(B): 6 | if dif + b in A: 7 | return [dif + b, b] -------------------------------------------------------------------------------- /problems/fibonacci_number/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def fib(self, n: int) -> int: 3 | if n == 0: 4 | return 0 5 | elif n == 1: 6 | return 1 7 | else: 8 | return self.fib(n-1) + self.fib(n-2) -------------------------------------------------------------------------------- /problems/find_numbers_with_even_number_of_digits/solution.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findNumbers(self, nums): 3 | """ 4 | :type nums: List[int] 5 | :rtype: int 6 | """ 7 | return len([num for num in nums if len(str(num))%2 == 0]) -------------------------------------------------------------------------------- /problems/find_the_highest_altitude/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def largestAltitude(self, gain: List[int]) -> int: 3 | s = 0 4 | L = [0] 5 | for i in range(len(gain)): 6 | s = s+ gain[i] 7 | L.append(s) 8 | return max(L) 9 | -------------------------------------------------------------------------------- /problems/find_the_index_of_the_first_occurrence_in_a_string/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def strStr(self, haystack: str, needle: str) -> int: 3 | return haystack.find(needle) -------------------------------------------------------------------------------- /problems/goal_parser_interpretation/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def interpret(self, command: str) -> str: 3 | if len(command) <=100 and len(command)>=1: 4 | command = command.replace("()","o") 5 | command = command.replace("(al)", "al") 6 | 7 | return command 8 | -------------------------------------------------------------------------------- /problems/gray_code/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def grayCode(self, n): 3 | if n == 0: return [0] 4 | t = self.grayCode(n-1) 5 | return t + [i+(1<<(n-1)) for i in t][::-1] -------------------------------------------------------------------------------- /problems/kth_smallest_element_in_a_sorted_matrix/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def kthSmallest(self, matrix: List[List[int]], k: int) -> int: 3 | a = [] 4 | for row in matrix: 5 | for i in row: 6 | a.append(i) 7 | a.sort() 8 | return a[k-1] -------------------------------------------------------------------------------- /problems/lucky_numbers_in_a_matrix/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def luckyNumbers(self, matrix: List[List[int]]) -> List[int]: 3 | return list({min(row) for row in matrix} & {max(col) for col in zip(*matrix)}) -------------------------------------------------------------------------------- /problems/maximum_product_difference_between_two_pairs/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProductDifference(self, nums: List[int]) -> int: 3 | nums.sort() 4 | return nums[-1]*nums[-2] - nums[0]*nums[1] -------------------------------------------------------------------------------- /problems/maximum_product_of_two_elements_in_an_array/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProduct(self, nums: List[int]) -> int: 3 | nums.sort() 4 | a = (nums[-1]-1)*(nums[-2]-1) 5 | b = (nums[0]-1)*(nums[1]-1) 6 | return max(a, b) -------------------------------------------------------------------------------- /problems/minimum_moves_to_equal_array_elements_ii/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minMoves2(self, nums: List[int]) -> int: 3 | nums.sort() 4 | ans, median = 0, nums[len(nums) // 2] 5 | for num in nums: ans += abs(median - num) 6 | return ans 7 | -------------------------------------------------------------------------------- /problems/missing_number/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def missingNumber(self, nums: List[int]) -> int: 3 | n = len(nums) 4 | 5 | return n*(n+1)//2 - sum(nums) -------------------------------------------------------------------------------- /problems/partitioning_into_minimum_number_of_deci-binary_numbers/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minPartitions(self, n: str) -> int: 3 | return max(n) -------------------------------------------------------------------------------- /problems/power_of_four/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPowerOfFour(self, n: int) -> bool: 3 | while n > 1: 4 | if n % 4 != 0 : return False 5 | n = n // 4 6 | return n == 1 -------------------------------------------------------------------------------- /problems/power_of_three/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPowerOfThree(self, n: int) -> bool: 3 | while n > 1: 4 | if n % 3 != 0: return False 5 | n = n //3 6 | return n == 1 -------------------------------------------------------------------------------- /problems/power_of_two/solution.py: -------------------------------------------------------------------------------- 1 | import math 2 | class Solution: 3 | def isPowerOfTwo(self, n: int) -> bool: 4 | if n <= 0: return False 5 | 6 | a = math.log(n) / math.log(2) 7 | a = round(a) 8 | return 2**a == n -------------------------------------------------------------------------------- /problems/reverse_string/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reverseString(self, s: List[str]) -> None: 3 | def rev(l, r, s): 4 | if l >= r: return 5 | s[l], s[r] = s[r], s[l] 6 | rev(l+1, r-1, s) 7 | 8 | return rev(0, len(s)-1, s) 9 | -------------------------------------------------------------------------------- /problems/richest_customer_wealth/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maximumWealth(self, accounts: List[List[int]]) -> int: 3 | LL = [] 4 | for i in range(len(accounts)): 5 | LL.append(sum(accounts[i])) 6 | return max(LL) 7 | -------------------------------------------------------------------------------- /problems/rotate_array/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def rotate(self, nums: List[int], k: int) -> None: 3 | for i in range(k): 4 | a = nums.pop() 5 | nums.insert(0, a) 6 | 7 | return nums 8 | -------------------------------------------------------------------------------- /problems/running_sum_of_1d_array/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def runningSum(self, nums: List[int]) -> List[int]: 3 | runningSum = [] 4 | Sum = 0 5 | for i in range(len(nums)): 6 | Sum += nums[i] 7 | runningSum.append(Sum) 8 | return runningSum 9 | -------------------------------------------------------------------------------- /problems/shuffle_string/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def restoreString(self, s: str, indices: List[int]) -> str: 3 | ans = [0]*len(s) 4 | for i in range(len(ans)): 5 | ans[indices[i]] = s[i] 6 | return ''.join(ans) -------------------------------------------------------------------------------- /problems/shuffle_the_array/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def shuffle(self, nums: List[int], n: int) -> List[int]: 3 | newL = [] 4 | if len(nums) == 2*n: 5 | for i in range(n): 6 | newL.append(nums[i]) 7 | newL.append(nums[n+i]) 8 | return newL -------------------------------------------------------------------------------- /problems/single_number/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def singleNumber(self, nums: List[int]) -> int: 3 | for i in nums: 4 | if nums.count(i) == 1: 5 | return i -------------------------------------------------------------------------------- /problems/sort_colors/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sortColors(self, nums: List[int]) -> None: 3 | for i in range(len(nums)-1): 4 | for j in range(len(nums)-1): 5 | if nums[j]>nums[j+1]: 6 | nums[j], nums[j+1] = nums[j+1], nums[j] 7 | -------------------------------------------------------------------------------- /problems/squares_of_a_sorted_array/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sortedSquares(self, nums: List[int]) -> List[int]: 3 | for i in range(len(nums)): 4 | nums[i] = (nums[i]) **2 5 | 6 | print(nums) 7 | nums.sort() 8 | return nums -------------------------------------------------------------------------------- /problems/sum_of_digits_in_base_k/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sumBase(self, n: int, k: int) -> int: 3 | sum = 0 4 | if n >= 1 and n<= 100 and k>= 2 and k<= 10: 5 | while n != 0: 6 | sum = sum + n%k 7 | n = n//k 8 | return sum 9 | -------------------------------------------------------------------------------- /problems/to_lower_case/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def toLowerCase(self, s: str) -> str: 3 | return s.lower() -------------------------------------------------------------------------------- /problems/truncate_sentence/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def truncateSentence(self, s: str, k: int) -> str: 3 | a = s.split() 4 | result = "" 5 | for i in range(k): 6 | result = result + a[i] + " " 7 | 8 | return result.rstrip(" ") -------------------------------------------------------------------------------- /problems/unique_paths/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def uniquePaths(self, m: int, n: int) -> int: 3 | dp = [[1]*n for i in range(m)] 4 | 5 | for i in range(1, m): 6 | for j in range(1, n): 7 | dp[i][j] = dp[i-1][j] + dp[i][j-1] 8 | 9 | return dp[-1][-1] -------------------------------------------------------------------------------- /problems/valid_anagram/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isAnagram(self, s: str, t: str) -> bool: 3 | s = list(s) 4 | s.sort() 5 | t = list(t) 6 | t.sort() 7 | return s == t 8 | -------------------------------------------------------------------------------- /problems/valid_palindrome/solution.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPalindrome(self, s: str) -> bool: 3 | a = "" 4 | for i in s: 5 | if ord("A")<= ord(i)<= ord("Z") or ord("a")<= ord(i)<= ord("z") or ord("0")<= ord(i)<= ord("9"): 6 | a += i.lower() 7 | return a == a[::-1] --------------------------------------------------------------------------------