From 55561bc4f5e106f40b62765286e45d325dba3f1f Mon Sep 17 00:00:00 2001 From: neetcode Date: Mon, 26 Dec 2022 12:49:19 -0800 Subject: [PATCH] Update file names --- .github/workflows/updateCompletionTable.js | 2 +- .problemList.json | 3088 ++++++------ .problemSiteData.json | 4239 +++++++++++++++++ c/{1-Two-Sum.c => 0001-two-sum.c} | 0 ...d-Two-Numbers.c => 0002-add-two-numbers.c} | 0 ...-substring-without-repeating-characters.c} | 0 ...s.c => 0004-median-of-two-sorted-arrays.c} | 0 ...c => 0005-longest-palindromic-substring.c} | 0 ...verse-Integer.c => 0007-reverse-integer.c} | 0 ...ter.c => 0011-container-with-most-water.c} | 0 ...> 0019-remove-nth-node-from-end-of-list.c} | 0 ...Parentheses.c => 0020-valid-parentheses.c} | 0 ...-Lists.c => 0021-merge-two-sorted-lists.c} | 0 ...ed-Lists.c => 0023-merge-k-sorted-lists.c} | 0 ...roup.c => 0025-reverse-nodes-in-k-group.c} | 0 ...Remove-Element.c => 0027-remove-element.c} | 0 ... => 0033-search-in-rotated-sorted-array.c} | 0 ...sition.c => 0035-search-insert-position.c} | 0 c/{36-Valid-Sudoku.c => 0036-valid-sudoku.c} | 0 ...ain-Water.c => 0042-trapping-rain-water.c} | 0 c/{45-Jump-Game-II.c => 0045-jump-game-ii.c} | 0 c/{48-Rotate-Image.c => 0048-rotate-image.c} | 0 c/{50-Pow-X-N.c => 0050-powx-n.c} | 0 c/{52-N-Queens-II.c => 0052-n-queens-ii.c} | 0 ...mum-Subarray.c => 0053-maximum-subarray.c} | 0 c/{55-Jump-Game.c => 0055-jump-game.c} | 0 ...Last-Word.c => 0058-length-of-last-word.c} | 0 c/{62-Unique-Paths.c => 0062-unique-paths.c} | 0 c/{66-Plus-One.c => 0066-plus-one.c} | 0 ...imbing-Stairs.c => 0070-climbing-stairs.c} | 0 ...trix-Zeroes.c => 0073-set-matrix-zeroes.c} | 0 ...-2D-Matrix.c => 0074-search-a-2d-matrix.c} | 0 c/{75-Sort-Colors.c => 0075-sort-colors.c} | 0 ...ring.c => 0076-minimum-window-substring.c} | 0 c/{78-Subsets.c => 0078-subsets.c} | 0 c/{79-Word-Search.c => 0079-word-search.c} | 0 ...rted-Array.c => 0088-merge-sorted-array.c} | 0 c/{91-Decode-Ways.c => 0091-decode-ways.c} | 0 ...c => 0094-binary-tree-inorder-traversal.c} | 0 ...ee.c => 0096-unique-binary-search-trees.c} | 0 ...e.c => 0098-validate-binary-search-tree.c} | 0 c/{100-Same-Tree.c => 0100-same-tree.c} | 0 ... 0102-binary-tree-level-order-traversal.c} | 0 ....c => 0104-maximum-depth-of-binary-tree.c} | 0 ...ree-from-preorder-and-inorder-traversal.c} | 0 ...vert-sorted-array-to-binary-search-tree.c} | 0 ...ary-Tree.c => 0110-balanced-binary-tree.c} | 0 c/{112-Path-Sum.c => 0112-path-sum.c} | 0 ...als-Triangle.c => 0118-pascals-triangle.c} | 0 ...=> 0121-best-time-to-buy-and-sell-stock.c} | 0 ...0122-best-time-to-buy-and-sell-stock-ii.c} | 0 ....c => 0124-binary-tree-maximum-path-sum.c} | 0 ...d-Palindrome.c => 0125-valid-palindrome.c} | 0 ...Leaf.c => 0129-sum-root-to-leaf-numbers.c} | 0 ...ed-Regions.c => 0130-surrounded-regions.c} | 0 c/{133-Clone-Graph.c => 0133-clone-graph.c} | 0 c/{134-Gas-Station.c => 0134-gas-station.c} | 0 ...6-Single-Number.c => 0136-single-number.c} | 0 ...c => 0138-copy-list-with-random-pointer.c} | 0 ...-List-Cycle.c => 0141-linked-list-cycle.c} | 0 c/{143-Reorder-List.c => 0143-reorder-list.c} | 0 c/{146-LRU-Cache.c => 0146-lru-cache.c} | 0 ...> 0150-evaluate-reverse-polish-notation.c} | 0 ...rray.c => 0152-maximum-product-subarray.c} | 0 ...53-find-minimum-in-rotated-sorted-array.c} | 0 ...> 0167-two-sum-ii-input-array-is-sorted.c} | 0 ...rity-Element.c => 0169-majority-element.c} | 0 c/{190-Reverse-Bits.c => 0190-reverse-bits.c} | 0 ...er-of-1-Bits.c => 0191-number-of-1-bits.c} | 0 c/{198-House-Robber.c => 0198-house-robber.c} | 0 ...w.c => 0199-binary-tree-right-side-view.c} | 0 ...-Of-Islands.c => 0200-number-of-islands.c} | 0 c/{202-Happy-Number.c => 0202-happy-number.c} | 0 ...ic-Strings.c => 0205-isomorphic-strings.c} | 0 ...nked-List.c => 0206-reverse-linked-list.c} | 0 ...ee.c => 0208-implement-trie-prefix-tree.c} | 0 ...Sum.c => 0209-minimum-size-subarray-sum.c} | 0 ...use-Robber-II.c => 0213-house-robber-ii.c} | 0 ...-Duplicate.c => 0217-contains-duplicate.c} | 0 ...inary-Tree.c => 0226-invert-binary-tree.c} | 0 ...c => 0230-kth-smallest-element-in-a-bst.c} | 0 ...common-ancestor-of-a-binary-search-tree.c} | 0 ....c => 0238-product-of-array-except-self.c} | 0 ...2-Valid-Anagram.c => 0242-valid-anagram.c} | 0 c/{263-Ugly-Number.c => 0263-ugly-number.c} | 0 ...Missing-Number.c => 0268-missing-number.c} | 0 c/{283-Move-Zeroes.c => 0283-move-zeroes.c} | 0 ...ber.c => 0287-find-the-duplicate-number.c} | 0 ...7-serialize-and-deserialize-binary-tree.c} | 0 ... => 0300-longest-increasing-subsequence.c} | 0 ...ime-to-buy-and-sell-stock-with-cooldown.c} | 0 c/{322-Coin-Change.c => 0322-coin-change.c} | 0 ...329-longest-increasing-path-in-a-matrix.c} | 0 ...8-Counting-Bits.c => 0338-counting-bits.c} | 0 ...Reverse-String.c => 0344-reverse-string.c} | 0 ...-Integers.c => 0371-sum-of-two-integers.c} | 0 ....c => 0374-guess-number-higher-or-lower.c} | 0 ...Is-Subsequence.c => 0392-is-subsequence.c} | 0 ...w.c => 0417-pacific-atlantic-water-flow.c} | 0 ...longest-repeating-character-replacement.c} | 0 ...nd-Perimeter.c => 0463-island-perimeter.c} | 0 ...Coin-Change-II.c => 0518-coin-change-ii.c} | 0 ...-Tree.c => 0543-diameter-of-binary-tree.c} | 0 ...-String.c => 0567-permutation-in-string.c} | 0 ...-Tree.c => 0572-subtree-of-another-tree.c} | 0 ...ace-Flowers.c => 0605-can-place-flowers.c} | 0 ...-Trees.c => 0617-merge-two-binary-trees.c} | 0 ...trings.c => 0647-palindromic-substrings.c} | 0 ...ring.c => 0678-valid-parenthesis-string.c} | 0 ...2-Baseball-Game.c => 0682-baseball-game.c} | 0 ...nnection.c => 0684-redundant-connection.c} | 0 ...-of-Island.c => 0695-max-area-of-island.c} | 0 ...=> 0703-kth-largest-element-in-a-stream.c} | 0 ...4-Binary-Search.c => 0704-binary-search.c} | 0 ...-Pivot-Index.c => 0724-find-pivot-index.c} | 0 ...mperatures.c => 0739-daily-temperatures.c} | 0 ...airs.c => 0746-min-cost-climbing-stairs.c} | 0 ...g-Bananas.c => 0875-koko-eating-bananas.c} | 0 ...e-People.c => 0881-boats-to-save-people.c} | 0 ...c => 0953-verifying-an-alien-dictionary.c} | 0 ...tting-Oranges.c => 0994-rotting-oranges.c} | 0 c/1189-maximum-number-of-balloons.c | 36 + c/1288-remove-covered-intervals.c | 34 + ...ents-with-greatest-element-on-right-side.c | 21 + c/1448-count-good-nodes-in-binary-tree.c | 18 + c/1905-count-sub-islands.c | 35 + ...ments-not-equal-to-average-of-neighbors.c} | 0 cpp/{1-Two-Sum.cpp => 0001-two-sum.cpp} | 0 ...o-Numbers.cpp => 0002-add-two-numbers.cpp} | 0 ...ubstring-without-repeating-characters.cpp} | 0 ...p => 0004-median-of-two-sorted-arrays.cpp} | 0 ...=> 0005-longest-palindromic-substring.cpp} | 0 ...e-Integer.cpp => 0007-reverse-integer.cpp} | 0 ...p => 0010-regular-expression-matching.cpp} | 0 ...cpp => 0011-container-with-most-water.cpp} | 0 ...Sum.cpp => 0014-longest-common-prefix.cpp} | 0 cpp/{15-3sum.cpp => 0015-3sum.cpp} | 0 ...letter-combinations-of-a-phone-number.cpp} | 0 ...0019-remove-nth-node-from-end-of-list.cpp} | 0 ...ntheses.cpp => 0020-valid-parentheses.cpp} | 0 ...ts.cpp => 0021-merge-two-sorted-lists.cpp} | 0 ...eses.cpp => 0022-generate-parentheses.cpp} | 0 ...ists.cpp => 0023-merge-k-sorted-lists.cpp} | 0 ....cpp => 0025-reverse-nodes-in-k-group.cpp} | 0 ...> 0033-search-in-rotated-sorted-array.cpp} | 0 ...on.cpp => 0035-search-insert-position.cpp} | 0 ...Valid-Sudoku.cpp => 0036-valid-sudoku.cpp} | 0 ...ation-Sum.cpp => 0039-combination-sum.cpp} | 0 ...Sum-II.cpp => 0040-combination-sum-ii.cpp} | 0 ...Water.cpp => 0042-trapping-rain-water.cpp} | 0 ...-Strings.cpp => 0043-multiply-strings.cpp} | 0 ...Jump-Game-II.cpp => 0045-jump-game-ii.cpp} | 0 ...Permutations.cpp => 0046-permutations.cpp} | 0 ...Rotate-Image.cpp => 0048-rotate-image.cpp} | 0 ...p-Anagrams.cpp => 0049-group-anagrams.cpp} | 0 cpp/{50-Pow-X-N.cpp => 0050-powx-n.cpp} | 0 cpp/{51-N-Queens.cpp => 0051-n-queens.cpp} | 0 ...52-N-Queens-2.cpp => 0052-n-queens-ii.cpp} | 0 ...Subarray.cpp => 0053-maximum-subarray.cpp} | 0 ...iral-Matrix.cpp => 0054-spiral-matrix.cpp} | 0 cpp/{55-Jump-Game.cpp => 0055-jump-game.cpp} | 0 ...Intervals.cpp => 0056-merge-intervals.cpp} | 0 ...-Interval.cpp => 0057-insert-interval.cpp} | 0 ...-Word.cpp => 0058-length-of-last-word.cpp} | 0 ...Unique-Paths.cpp => 0062-unique-paths.cpp} | 0 ...Path-Sum.cpp => 0064-minimum-path-sum.cpp} | 0 cpp/{66-Plus-One.cpp => 0066-plus-one.cpp} | 0 ...ng-Stairs.cpp => 0070-climbing-stairs.cpp} | 0 ...it-Distance.cpp => 0072-edit-distance.cpp} | 0 ...-Zeroes.cpp => 0073-set-matrix-zeroes.cpp} | 0 ...Matrix.cpp => 0074-search-a-2d-matrix.cpp} | 0 ....cpp => 0076-minimum-window-substring.cpp} | 0 cpp/{78-Subsets.cpp => 0078-subsets.cpp} | 0 ...9-Word-Search.cpp => 0079-word-search.cpp} | 0 ...83-remove-duplicates-from-sorted-list.cpp} | 0 ...> 0084-largest-rectangle-in-histogram.cpp} | 0 ...{90-Subsets-II.cpp => 0090-subsets-ii.cpp} | 0 ...1-Decode-Ways.cpp => 0091-decode-ways.cpp} | 0 ...tring.cpp => 0097-interleaving-string.cpp} | 0 ...p => 0098-validate-binary-search-tree.cpp} | 0 cpp/{100-Same-Tree.cpp => 0100-same-tree.cpp} | 0 ...102-binary-tree-level-order-traversal.cpp} | 0 ... => 0104-maximum-depth-of-binary-tree.cpp} | 0 ...e-from-preorder-and-inorder-traversal.cpp} | 0 ...Tree.cpp => 0110-balanced-binary-tree.cpp} | 0 ...ces.cpp => 0115-distinct-subsequences.cpp} | 0 ...Triangle.cpp => 0118-pascals-triangle.cpp} | 0 cpp/{120-Triangle.cpp => 0120-triangle.cpp} | 0 ... 0121-best-time-to-buy-and-sell-stock.cpp} | 0 ... => 0124-binary-tree-maximum-path-sum.cpp} | 0 ...lindrome.cpp => 0125-valid-palindrome.cpp} | 0 ...7-Word-Ladder.cpp => 0127-word-ladder.cpp} | 0 ... => 0128-longest-consecutive-sequence.cpp} | 0 ...egions.cpp => 0130-surrounded-regions.cpp} | 0 ...g.cpp => 0131-palindrome-partitioning.cpp} | 0 ...3-Clone-Graph.cpp => 0133-clone-graph.cpp} | 0 ...4-Gas-Station.cpp => 0134-gas-station.cpp} | 0 ...ngle-Number.cpp => 0136-single-number.cpp} | 0 ...=> 0138-copy-list-with-random-pointer.cpp} | 0 ...139-Word-Break.cpp => 0139-word-break.cpp} | 0 ...t-Cycle.cpp => 0141-linked-list-cycle.cpp} | 0 ...Reorder-List.cpp => 0143-reorder-list.cpp} | 0 cpp/{146-Lru-Cache.cpp => 0146-lru-cache.cpp} | 0 ...0150-evaluate-reverse-polish-notation.cpp} | 0 ....cpp => 0152-maximum-product-subarray.cpp} | 0 ...-find-minimum-in-rotated-sorted-array.cpp} | 0 cpp/{155-Min-Stack.cpp => 0155-min-stack.cpp} | 0 ...0167-two-sum-ii-input-array-is-sorted.cpp} | 0 ...-Element.cpp => 0169-majority-element.cpp} | 0 ...Rotate-Array.cpp => 0189-rotate-array.cpp} | 0 ...Reverse-Bits.cpp => 0190-reverse-bits.cpp} | 0 ...f-1-Bits.cpp => 0191-number-of-1-bits.cpp} | 0 ...House-Robber.cpp => 0198-house-robber.cpp} | 0 ...p => 0199-binary-tree-right-side-view.cpp} | 0 ...Islands.cpp => 0200-number-of-islands.cpp} | 0 ...Happy-Number.cpp => 0202-happy-number.cpp} | 0 ...-List.cpp => 0206-reverse-linked-list.cpp} | 0 ...-Schedule.cpp => 0207-course-schedule.cpp} | 0 ...pp => 0208-implement-trie-prefix-tree.cpp} | 0 ...cpp => 0209-minimum-size-subarray-sum.cpp} | 0 ...ule-II.cpp => 0210-course-schedule-ii.cpp} | 0 ...n-add-and-search-words-data-structure.cpp} | 0 ...-Search-II.cpp => 0212-word-search-ii.cpp} | 0 ...Robber-II.cpp => 0213-house-robber-ii.cpp} | 0 ... 0215-kth-largest-element-in-an-array.cpp} | 0 ...licate.cpp => 0217-contains-duplicate.cpp} | 0 ... => 0225-implement-stack-using-queues.cpp} | 0 ...y-Tree.cpp => 0226-invert-binary-tree.cpp} | 0 ...=> 0230-kth-smallest-element-in-a-bst.cpp} | 0 ...st.cpp => 0234-palindrome-linked-list.cpp} | 0 ...mmon-ancestor-of-a-binary-search-tree.cpp} | 0 ... => 0238-product-of-array-except-self.cpp} | 0 ...um.cpp => 0239-sliding-window-maximum.cpp} | 0 ...ram-Hashmap.cpp => 0242-valid-anagram.cpp} | 0 ...ng-Rooms-II.cpp => 0253-meeting-rooms.cpp} | 0 ...lid-Tree.cpp => 0261-graph-valid-tree.cpp} | 0 ...ing-Number.cpp => 0268-missing-number.cpp} | 0 ...ctionary.cpp => 0269-alien-dictionary.cpp} | 0 ...cpp => 0271-encode-and-decode-strings.cpp} | 0 ...3-Move-Zeroes.cpp => 0283-move-zeroes.cpp} | 0 ...And-Gates.cpp => 0286-walls-and-gates.cpp} | 0 ...cpp => 0287-find-the-duplicate-number.cpp} | 0 ... => 0295-find-median-from-data-stream.cpp} | 0 ...serialize-and-deserialize-binary-tree.cpp} | 0 ...> 0300-longest-increasing-subsequence.cpp} | 0 ...e-to-buy-and-sell-stock-with-cooldown.cpp} | 0 ...t-Balloons.cpp => 0312-burst-balloons.cpp} | 0 ...2-Coin-Change.cpp => 0322-coin-change.cpp} | 0 ...ted-components-in-an-undirected-graph.cpp} | 0 ...9-longest-increasing-path-in-a-matrix.cpp} | 0 ...ary.cpp => 0332-reconstruct-itinerary.cpp} | 0 ...unting-Bits.cpp => 0338-counting-bits.cpp} | 0 ...s.cpp => 0347-top-k-frequent-elements.cpp} | 0 ...gn-Twitter.cpp => 0355-design-twitter.cpp} | 0 ...egers.cpp => 0371-sum-of-two-integers.cpp} | 0 ...ubsequence.cpp => 0392-is-subsequence.cpp} | 0 ...-K-Digits.cpp => 0402-remove-k-digits.cpp} | 0 ...pp => 0416-partition-equal-subset-sum.cpp} | 0 ...p => 0417-pacific-atlantic-water-flow.cpp} | 0 ...ngest-repeating-character-replacement.cpp} | 0 ...cpp => 0435-non-overlapping-intervals.cpp} | 0 ...=> 0438-find-all-anagrams-in-a-string.cpp} | 0 ...d-all-numbers-disappeared-in-an-array.cpp} | 0 ...erimeter.cpp => 0463-island-perimeter.cpp} | 0 ...are.cpp => 0473-matchsticks-to-square.cpp} | 0 ...494-Target-Sum.cpp => 0494-target-sum.cpp} | 0 ...n-Change-2.cpp => 0518-coin-change-ii.cpp} | 0 ...e.cpp => 0543-diameter-of-binary-tree.cpp} | 0 ...ing.cpp => 0567-permutation-in-string.cpp} | 0 ...e.cpp => 0572-subtree-of-another-tree.cpp} | 0 ...Flowers.cpp => 0605-can-place-flowers.cpp} | 0 ...-Scheduler.cpp => 0621-task-scheduler.cpp} | 0 ...gs.cpp => 0647-palindromic-substrings.cpp} | 0 ....cpp => 0678-valid-parenthesis-string.cpp} | 0 ...seball-Game.cpp => 0682-baseball-game.cpp} | 0 ...tion.cpp => 0684-redundant-connection.cpp} | 0 ...Island.cpp => 0695-max-area-of-island.cpp} | 0 ... 0703-kth-largest-element-in-a-stream.cpp} | 0 ...nary-Search.cpp => 0704-binary-search.cpp} | 0 ...ot-Index.cpp => 0724-find-pivot-index.cpp} | 0 ...atures.cpp => 0739-daily-temperatures.cpp} | 0 ...y-Time.cpp => 0743-network-delay-time.cpp} | 0 ....cpp => 0746-min-cost-climbing-stairs.cpp} | 0 ...n-Labels.cpp => 0763-partition-labels.cpp} | 0 ...ater.cpp => 0778-swim-in-rising-water.cpp} | 0 ... 0787-cheapest-flights-within-k-stops.cpp} | 0 ...raights.cpp => 0846-hand-of-straights.cpp} | 0 cpp/{853-Car-Fleet.cpp => 0853-car-fleet.cpp} | 0 ...nanas.cpp => 0875-koko-eating-bananas.cpp} | 0 ...=> 0953-verifying-an-alien-dictionary.cpp} | 0 ...pp => 0973-k-closest-points-to-origin.cpp} | 0 ...cpp => 0977-squares-of-a-sorted-array.cpp} | 0 ...pp => 0981-time-based-key-value-store.cpp} | 0 ...g-Oranges.cpp => 0994-rotting-oranges.cpp} | 0 cpp/1046-last-stone-weight.cpp | 35 + cpp/1143-longest-common-subsequence.cpp | 37 + ...e-all-adjacent-duplicates-in-string-ii.cpp | 39 + ...ts-with-greatest-element-on-right-side.cpp | 17 + cpp/1448-count-good-nodes-in-binary-tree.cpp | 41 + cpp/1584-min-cost-to-connect-all-points.cpp | 54 + ...minimum-interval-to-include-each-query.cpp | 54 + cpp/20-Valid-Parenthesis-String.cpp | 43 - cpp/2013-detect-squares.cpp | 53 + csharp/{1-Two-Sum.cs => 0001-two-sum.cs} | 0 ...Two-Numbers.cs => 0002-add-two-numbers.cs} | 0 ...substring-without-repeating-characters.cs} | 0 ...cs => 0004-median-of-two-sorted-arrays.cs} | 0 ... => 0005-longest-palindromic-substring.cs} | 0 ...rse-Integer.cs => 0007-reverse-integer.cs} | 0 ...cs => 0010-regular-expression-matching.cs} | 0 ...r.cs => 0011-container-with-most-water.cs} | 0 csharp/{15-3Sum.cs => 0015-3sum.cs} | 0 ...-letter-combinations-of-a-phone-number.cs} | 0 ... 0019-remove-nth-node-from-end-of-list.cs} | 0 ...rentheses.cs => 0020-valid-parentheses.cs} | 0 ...ists.cs => 0021-merge-two-sorted-lists.cs} | 0 ...theses.cs => 0022-generate-parentheses.cs} | 0 ...-Lists.cs => 0023-merge-k-sorted-lists.cs} | 0 ...up.cs => 0025-reverse-nodes-in-k-group.cs} | 0 ...=> 0033-search-in-rotated-sorted-array.cs} | 0 ...st-position-of-element-in-sorted-array.cs} | 0 ...6-Valid-Sudoku.cs => 0036-valid-sudoku.cs} | 0 ...ination-Sum.cs => 0039-combination-sum.cs} | 0 ...n-Sum-II.cs => 0040-combination-sum-ii.cs} | 0 ...n-Water.cs => 0042-trapping-rain-water.cs} | 0 ...ly-Strings.cs => 0043-multiply-strings.cs} | 0 ...5-Jump-Game-II.cs => 0045-jump-game-ii.cs} | 0 ...6-Permutations.cs => 0046-permutations.cs} | 0 ...8-Rotate-Image.cs => 0048-rotate-image.cs} | 0 ...oup-Anagrams.cs => 0049-group-anagrams.cs} | 0 csharp/{50-Pow(x, n).cs => 0050-powx-n.cs} | 0 csharp/{51-N-Queens.cs => 0051-n-queens.cs} | 0 ...m-Subarray.cs => 0053-maximum-subarray.cs} | 0 ...Spiral-Matrix.cs => 0054-spiral-matrix.cs} | 0 csharp/{55-Jump-Game.cs => 0055-jump-game.cs} | 0 ...e-Intervals.cs => 0056-merge-intervals.cs} | 0 ...rt-Interval.cs => 0057-insert-interval.cs} | 0 ...st-Word.cs => 0058-length-of-last-word.cs} | 0 ...2-Unique-Paths.cs => 0062-unique-paths.cs} | 0 csharp/{66-Plus-One.cs => 0066-plus-one.cs} | 0 ...bing Stairs.cs => 0070-climbing-stairs.cs} | 0 ...Edit-Distance.cs => 0072-edit-distance.cs} | 0 ...ix-Zeroes.cs => 0073-set-matrix-zeroes.cs} | 0 ...D-Matrix.cs => 0074-search-a-2d-matrix.cs} | 0 ...ng.cs => 0076-minimum-window-substring.cs} | 0 csharp/{78-Subsets.cs => 0078-subsets.cs} | 0 ...{79-Word-Search.cs => 0079-word-search.cs} | 0 ...=> 0084-largest-rectangle-in-histogram.cs} | 0 .../{90-Subsets-II.cs => 0090-subsets-ii.cs} | 0 ...{91-Decode-Ways.cs => 0091-decode-ways.cs} | 0 ...-String.cs => 0097-interleaving-string.cs} | 0 ...cs => 0098-validate-binary-search-tree.cs} | 0 .../{100-Same-Tree.cs => 0100-same-tree.cs} | 0 ...0102-binary-tree-level-order-traversal.cs} | 0 ...s => 0104-maximum-depth-of-binary-tree.cs} | 0 ...ee-from-preorder-and-inorder-traversal.cs} | 0 ...y-Tree.cs => 0110-balanced-binary-tree.cs} | 0 csharp/{112-Path-Sum.cs => 0112-path-sum.cs} | 0 ...ences.cs => 0115-distinct-subsequences.cs} | 0 ...> 0121-best-time-to-buy-and-sell-stock.cs} | 0 ...s => 0124-binary-tree-maximum-path-sum.cs} | 0 ...Palindrome.cs => 0125-valid-palindrome.cs} | 0 ...127-Word-Ladder.cs => 0127-word-ladder.cs} | 0 ...s => 0128-longest-consecutive-sequence.cs} | 0 ...-Regions.cs => 0130-surrounded-regions.cs} | 0 ...ing.cs => 0131-palindrome-partitioning.cs} | 0 ...133-Clone-Graph.cs => 0133-clone-graph.cs} | 0 ...134-Gas-Station.cs => 0134-gas-station.cs} | 0 ...Single-Number.cs => 0136-single-number.cs} | 0 ... => 0138-copy-list-with-random-pointer.cs} | 0 .../{139-Word-Break.cs => 0139-word-break.cs} | 0 ...ist-Cycle.cs => 0141-linked-list-cycle.cs} | 0 ...3-Reorder-List.cs => 0143-reorder-list.cs} | 0 .../{146-LRU-Cache.cs => 0146-lru-cache.cs} | 0 ... 0150-evaluate-reverse-polish-notation.cs} | 0 ...ay.cs => 0152-maximum-product-subarray.cs} | 0 ...3-find-minimum-in-rotated-sorted-array.cs} | 0 .../{155-Min-Stack.cs => 0155-min-stack.cs} | 0 ... 0167-two-sum-ii-input-array-is-sorted.cs} | 0 ...0-Reverse-Bits.cs => 0190-reverse-bits.cs} | 0 ...-Of-1-Bits.cs => 0191-number-of-1-bits.cs} | 0 ...8-House-Robber.cs => 0198-house-robber.cs} | 0 ...cs => 0199-binary-tree-right-side-view.cs} | 0 ...f-Islands.cs => 0200-number-of-islands.cs} | 0 ...2-Happy-Number.cs => 0202-happy-number.cs} | 0 ...ed-List.cs => 0206-reverse-linked-list.cs} | 0 ...se-Schedule.cs => 0207-course-schedule.cs} | 0 ....cs => 0208-implement-trie-prefix-tree.cs} | 0 ...edule-II.cs => 0210-course-schedule-ii.cs} | 0 ...gn-add-and-search-words-data-structure.cs} | 0 ...rd-Search-II.cs => 0212-word-search-ii.cs} | 0 ...e-Robber-II.cs => 0213-house-robber-ii.cs} | 0 ...> 0215-kth-largest-element-in-an-array.cs} | 0 ...uplicate.cs => 0217-contains-duplicate.cs} | 0 ...ary-Tree.cs => 0226-invert-binary-tree.cs} | 0 ... => 0230-kth-smallest-element-in-a-bst.cs} | 0 ...ommon-ancestor-of-a-binary-search-tree.cs} | 0 ...s => 0238-product-of-array-except-self.cs} | 0 ...imum.cs => 0239-sliding-window-maximum.cs} | 0 ...Valid-Anagram.cs => 0242-valid-anagram.cs} | 0 ...ting-Rooms-II.cs => 0253-meeting-rooms.cs} | 0 ...Valid-Tree.cs => 0261-graph-valid-tree.cs} | 0 ...ssing-Number.cs => 0268-missing-number.cs} | 0 ...Dictionary.cs => 0269-alien-dictionary.cs} | 0 ... .cs => 0271-encode-and-decode-strings.cs} | 0 ...s-and-Gates.cs => 0286-walls-and-gates.cs} | 0 ...r.cs => 0287-find-the-duplicate-number.cs} | 0 ...s => 0295-find-median-from-data-stream.cs} | 0 ...-serialize-and-deserialize-binary-tree.cs} | 0 ...=> 0300-longest-increasing-subsequence.cs} | 0 ...me-to-buy-and-sell-stock-with-cooldown.cs} | 0 ...rst-Balloons.cs => 0312-burst-balloons.cs} | 0 ...322-Coin-Change.cs => 0322-coin-change.cs} | 0 ...cted-components-in-an-undirected-graph.cs} | 0 ...29-longest-increasing-path-in-a-matrix.cs} | 0 ...erary.cs => 0332-reconstruct-itinerary.cs} | 0 ...Counting-Bits.cs => 0338-counting-bits.cs} | 0 ...nts.cs => 0347-top-k-frequent-elements.cs} | 0 ...sign-Twitter.cs => 0355-design-twitter.cs} | 0 ...ntegers.cs => 0371-sum-of-two-integers.cs} | 0 ...-Subsequence.cs => 0392-is-subsequence.cs} | 0 ....cs => 0416-partition-equal-subset-sum.cs} | 0 ...cs => 0417-pacific-atlantic-water-flow.cs} | 0 ...ongest-repeating-character-replacement.cs} | 0 ...s.cs => 0435-non-overlapping-intervals.cs} | 0 ... => 0438-find-all-anagrams-in-a-string.cs} | 0 ...-Perimeter.cs => 0463-island-perimeter.cs} | 0 .../{494-Target-Sum.cs => 0494-target-sum.cs} | 0 ...in-Change-II.cs => 0518-coin-change-ii.cs} | 0 ...ree.cs => 0543-diameter-of-binary-tree.cs} | 0 ...tring.cs => 0567-permutation-in-string.cs} | 0 ...ree.cs => 0572-subtree-of-another-tree.cs} | 0 ...sk-Scheduler.cs => 0621-task-scheduler.cs} | 0 ...ings.cs => 0647-palindromic-substrings.cs} | 0 ...ng.cs => 0678-valid-parenthesis-string.cs} | 0 ...ection.cs => 0684-redundant-connection.cs} | 0 ...f-Island.cs => 0695-max-area-of-island.cs} | 0 ...> 0703-kth-largest-element-in-a-stream.cs} | 0 ...Binary-Search.cs => 0704-binary-search.cs} | 0 ...eratures.cs => 0739-daily-temperatures.cs} | 0 ...lay-Time.cs => 0743-network-delay-time.cs} | 0 ...rs.cs => 0746-min-cost-climbing-stairs.cs} | 0 ...Open-the-Lock.cs => 0752-open-the-lock.cs} | 0 ...ion-Labels.cs => 0763-partition-labels.cs} | 0 ...-Water.cs => 0778-swim-in-rising-water.cs} | 0 ...> 0787-cheapest-flights-within-k-stops.cs} | 0 ...Straights.cs => 0846-hand-of-straights.cs} | 0 .../{853-Car-Fleet.cs => 0853-car-fleet.cs} | 0 ...Bananas.cs => 0875-koko-eating-bananas.cs} | 0 ...-Ladders.cs => 0909-snakes-and-ladders.cs} | 0 ....cs => 0973-k-closest-points-to-origin.cs} | 0 ....cs => 0981-time-based-key-value-store.cs} | 0 ...ing-Oranges.cs => 0994-rotting-oranges.cs} | 0 csharp/1046-last-stone-weight.cs | 49 + csharp/1094-car-pooling.cs | 19 + csharp/1143-longest-common-subsequence.cs | 23 + ...nts-with-greatest-element-on-right-side.cs | 11 + csharp/1383-maximum-performance-of-a-team.cs | 36 + ...aximum-points-you-can-obtain-from-cards.cs | 21 + .../1448-count-good-nodes-in-binary-tree.cs | 30 + ...to-make-all-paths-lead-to-the-city-zero.cs | 47 + csharp/1584-min-cost-to-connect-all-points.cs | 60 + ...-frequency-of-the-most-frequent-element.cs | 22 + ...-minimum-interval-to-include-each-query.cs | 44 + csharp/1905-count-sub-islands.cs | 30 + csharp/2013-detect-squares.cs | 35 + go/{1-Two-Sum.go => 0001-two-sum.go} | 0 ...substring-without-repeating-characters.go} | 0 ...go => 0004-median-of-two-sorted-arrays.go} | 0 ...rse-Integer.go => 0007-reverse-integer.go} | 0 ...r.go => 0011-container-with-most-water.go} | 0 ...To-Integer.go => 0013-roman-to-integer.go} | 0 go/{15-3Sum.go => 0015-3sum.go} | 0 ...-letter-combinations-of-a-phone-number.go} | 0 ... 0019-remove-nth-node-from-end-of-list.go} | 0 ...rentheses.go => 0020-valid-parentheses.go} | 0 ...ists.go => 0021-merge-two-sorted-lists.go} | 0 ...theses.go => 0022-generate-parentheses.go} | 0 ...n-Pairs.go => 0024-swap-nodes-in-pairs.go} | 0 ...26-remove-duplicates-from-sorted-array.go} | 0 ...move-Element.go => 0027-remove-element.go} | 0 ...=> 0033-search-in-rotated-sorted-array.go} | 0 ...6-Valid-Sudoku.go => 0036-valid-sudoku.go} | 0 ...ination-Sum.go => 0039-combination-sum.go} | 0 ...n-Sum-II.go => 0040-combination-sum-ii.go} | 0 ...n-Water.go => 0042-trapping-rain-water.go} | 0 ...5-Jump-Game-II.go => 0045-jump-game-ii.go} | 0 ...6-Permutations.go => 0046-permutations.go} | 0 ...8-Rotate-Image.go => 0048-rotate-image.go} | 0 ...oup-Anagrams.go => 0049-group-anagrams.go} | 0 go/{51-N-Queens.go => 0051-n-queens.go} | 0 ...m-Subarray.go => 0053-maximum-subarray.go} | 0 go/{55-Jump-Game.go => 0055-jump-game.go} | 0 ...e-Intervals.go => 0056-merge-intervals.go} | 0 ...2-Unique-Paths.go => 0062-unique-paths.go} | 0 go/{66-Plus-One.go => 0066-plus-one.go} | 0 ...bing-Stairs.go => 0070-climbing-stairs.go} | 0 ...ix-Zeroes.go => 0073-set-matrix-zeroes.go} | 0 ...D-Matrix.go => 0074-search-a-2d-matrix.go} | 0 go/{75-Sort-Colors.go => 0075-sort-colors.go} | 0 ...ng.go => 0076-minimum-window-substring.go} | 0 go/{78-Subsets.go => 0078-subsets.go} | 0 go/{79-Word-Search.go => 0079-word-search.go} | 0 ...083-remove-duplicates-from-sorted-list.go} | 0 ...=> 0084-largest-rectangle-in-histogram.go} | 0 go/{90-Subsets-II.go => 0090-subsets-ii.go} | 0 ...go => 0098-validate-binary-search-tree.go} | 0 go/{100-Same-Tree.go => 0100-same-tree.go} | 0 ...0102-binary-tree-level-order-traversal.go} | 0 ...o => 0104-maximum-depth-of-binary-tree.go} | 0 ...y-Tree.go => 0110-balanced-binary-tree.go} | 0 ...> 0121-best-time-to-buy-and-sell-stock.go} | 0 ...122-best-time-to-buy-and-sell-stock-ii.go} | 0 ...o => 0124-binary-tree-maximum-path-sum.go} | 0 ...Palindrome.go => 0125-valid-palindrome.go} | 0 ...o => 0128-longest-consecutive-sequence.go} | 0 ...-Regions.go => 0130-surrounded-regions.go} | 0 ...ing.go => 0131-palindrome-partitioning.go} | 0 ...133-Clone-Graph.go => 0133-clone-graph.go} | 0 ...134-Gas-Station.go => 0134-gas-station.go} | 0 ...Single-Number.go => 0136-single-number.go} | 0 ...ist-Cycle.go => 0141-linked-list-cycle.go} | 0 ...3-Reorder-List.go => 0143-reorder-list.go} | 0 ... 0150-evaluate-reverse-polish-notation.go} | 0 ...ay.go => 0152-maximum-product-subarray.go} | 0 ...3-find-minimum-in-rotated-sorted-array.go} | 0 go/{155-Min-Stack.go => 0155-min-stack.go} | 0 ... 0167-two-sum-ii-input-array-is-sorted.go} | 0 ...0-Reverse-Bits.go => 0190-reverse-bits.go} | 0 ...-of-1-Bits.go => 0191-number-of-1-bits.go} | 0 ...8-House-Robber.go => 0198-house-robber.go} | 0 ...2-Happy-Number.go => 0202-happy-number.go} | 0 ...go => 0203-remove-linked-list-elements.go} | 0 ...ed-List.go => 0206-reverse-linked-list.go} | 0 ...se-Schedule.go => 0207-course-schedule.go} | 0 ....go => 0208-implement-trie-prefix-tree.go} | 0 ...e-Robber-II.go => 0213-house-robber-ii.go} | 0 ...uplicate.go => 0217-contains-duplicate.go} | 0 ...o => 0225-implement-stack-using-queues.go} | 0 ...ary-Tree.go => 0226-invert-binary-tree.go} | 0 ... => 0230-kth-smallest-element-in-a-bst.go} | 0 ...ommon-ancestor-of-a-binary-search-tree.go} | 0 ...o => 0238-product-of-array-except-self.go} | 0 ...imum.go => 0239-sliding-window-maximum.go} | 0 ...Valid-Anagram.go => 0242-valid-anagram.go} | 0 ...ssing-Number.go => 0268-missing-number.go} | 0 ...s.go => 0271-encode-and-decode-strings.go} | 0 ...r.go => 0287-find-the-duplicate-number.go} | 0 ...me-to-buy-and-sell-stock-with-cooldown.go} | 0 ...cted-components-in-an-undirected-graph.go} | 0 ...Counting-Bits.go => 0338-counting-bits.go} | 0 ...nts.go => 0347-top-k-frequent-elements.go} | 0 ...ntegers.go => 0371-sum-of-two-integers.go} | 0 ...-Subsequence.go => 0392-is-subsequence.go} | 0 ...ongest-repeating-character-replacement.go} | 0 ...s.go => 0435-non-overlapping-intervals.go} | 0 go/{494-Target-Sum.go => 0494-target-sum.go} | 0 ...ree.go => 0543-diameter-of-binary-tree.go} | 0 ...tring.go => 0567-permutation-in-string.go} | 0 ...ree.go => 0572-subtree-of-another-tree.go} | 0 ...ection.go => 0684-redundant-connection.go} | 0 ...f-Island.go => 0695-max-area-of-island.go} | 0 ...Binary-Search.go => 0704-binary-search.go} | 0 ...eratures.go => 0739-daily-temperatures.go} | 0 ...rs.go => 0746-min-cost-climbing-stairs.go} | 0 ...ion-Labels.go => 0763-partition-labels.go} | 0 ...> 0787-cheapest-flights-within-k-stops.go} | 0 go/{853-Car-Fleet.go => 0853-car-fleet.go} | 0 ...Bananas.go => 0875-koko-eating-bananas.go} | 0 ....go => 0981-time-based-key-value-store.go} | 0 go/1143-longest-common-subsequence.go | 26 + ...nts-with-greatest-element-on-right-side.go | 16 + ...> 1448-count-good-nodes-in-binary-tree.go} | 0 java/{1-Two-Sum.java => 0001-two-sum.java} | 0 ...Numbers.java => 0002-add-two-numbers.java} | 0 ...bstring-without-repeating-characters.java} | 0 ... => 0004-median-of-two-sorted-arrays.java} | 0 ...> 0005-longest-palindromic-substring.java} | 0 ...rsion.java => 0006-zigzag-conversion.java} | 0 ...Integer.java => 0007-reverse-integer.java} | 0 ... => 0010-regular-expression-matching.java} | 0 ...va => 0011-container-with-most-water.java} | 0 java/{15-3Sum.java => 0015-3sum.java} | 0 ...etter-combinations-of-a-phone-number.java} | 0 ...019-remove-nth-node-from-end-of-list.java} | 0 ...heses.java => 0020-valid-parentheses.java} | 0 ....java => 0021-merge-two-sorted-lists.java} | 0 ...es.java => 0022-generate-parentheses.java} | 0 ...ts.java => 0023-merge-k-sorted-lists.java} | 0 ...ava => 0025-reverse-nodes-in-k-group.java} | 0 ...-Element.java => 0027-remove-element.java} | 0 ... 0033-search-in-rotated-sorted-array.java} | 0 ...lid-Sudoku.java => 0036-valid-sudoku.java} | 0 ...ion-Sum.java => 0039-combination-sum.java} | 0 ...m-II.java => 0040-combination-sum-ii.java} | 0 ...ter.java => 0042-trapping-rain-water.java} | 0 ...trings.java => 0043-multiply-strings.java} | 0 ...mp-game-II.java => 0045-jump-game-ii.java} | 0 ...rmutations.java => 0046-permutations.java} | 0 ...tate-Image.java => 0048-rotate-image.java} | 0 ...Anagrams.java => 0049-group-anagrams.java} | 0 java/{50-Pow(x, n).java => 0050-powx-n.java} | 0 java/{51-N-Queens.java => 0051-n-queens.java} | 0 ...barray.java => 0053-maximum-subarray.java} | 0 ...al-Matrix.java => 0054-spiral-matrix.java} | 0 ...{55-Jump-Game.java => 0055-jump-game.java} | 0 ...tervals.java => 0056-merge-intervals.java} | 0 ...nterval.java => 0057-insert-interval.java} | 0 ...ord.java => 0058-length-of-last-word.java} | 0 ...ique-Paths.java => 0062-unique-paths.java} | 0 ...th-Sum.java => 0064-minimum-path-sum.java} | 0 java/{66-Plus-One.java => 0066-plus-one.java} | 0 ...-Stairs.java => 0070-climbing-stairs.java} | 0 ...-Distance.java => 0072-edit-distance.java} | 0 ...eroes.java => 0073-set-matrix-zeroes.java} | 0 ...trix.java => 0074-search-a-2d-matrix.java} | 0 ...Sort-Colors.java => 0075-sort-colors.java} | 0 ...ava => 0076-minimum-window-substring.java} | 0 java/{78-Subsets.java => 0078-subsets.java} | 0 ...Word-Search.java => 0079-word-search.java} | 0 ... 0084-largest-rectangle-in-histogram.java} | 0 ...rray.java => 0088-merge-sorted-array.java} | 0 ...0-Subsets-II.java => 0090-subsets-ii.java} | 0 ...Decode-Ways.java => 0091-decode-ways.java} | 0 ...ing.java => 0097-interleaving-string.java} | 0 ... => 0098-validate-binary-search-tree.java} | 0 ...100-Same-Tree.java => 0100-same-tree.java} | 0 ...02-binary-tree-level-order-traversal.java} | 0 ...=> 0104-maximum-depth-of-binary-tree.java} | 0 ...-from-preorder-and-inorder-traversal.java} | 0 ...ee.java => 0110-balanced-binary-tree.java} | 0 ...s.java => 0115-distinct-subsequences.java} | 0 ...iangle.java => 0118-pascals-triangle.java} | 0 .../{120-Triangle.java => 0120-triangle.java} | 0 ...0121-best-time-to-buy-and-sell-stock.java} | 0 ...=> 0124-binary-tree-maximum-path-sum.java} | 0 ...ndrome.java => 0125-valid-palindrome.java} | 0 ...Word-Ladder.java => 0127-word-ladder.java} | 0 ...=> 0128-longest-consecutive-sequence.java} | 0 ...ions.java => 0130-surrounded-regions.java} | 0 ...java => 0131-palindrome-partitioning.java} | 0 ...Clone-Graph.java => 0133-clone-graph.java} | 0 ...Gas-Station.java => 0134-gas-station.java} | 0 ...le-Number.java => 0136-single-number.java} | 0 ...> 0138-copy-list-with-random-pointer.java} | 0 ...-Word- Break.java => 0139-word-break.java} | 0 ...order-List.java => 0143-reorder-list.java} | 0 ...146-LRU-Cache.java => 0146-lru-cache.java} | 0 ...150-evaluate-reverse-polish-notation.java} | 0 ...ava => 0152-maximum-product-subarray.java} | 0 ...find-minimum-in-rotated-sorted-array.java} | 0 ...155-Min-Stack.java => 0155-min-stack.java} | 0 ...167-two-sum-ii-input-array-is-sorted.java} | 0 ... => 0173-binary-search-tree-iterator.java} | 0 ....java => 0187-repeated-dna-sequences.java} | 0 ...verse-Bits.java => 0190-reverse-bits.java} | 0 ...1-Bits.java => 0191-number-of-1-bits.java} | 0 ...use-Robber.java => 0198-house-robber.java} | 0 ... => 0199-binary-tree-right-side-view.java} | 0 ...lands.java => 0200-number-of-islands.java} | 0 ...ppy-Number.java => 0202-happy-number.java} | 0 ...ings.java => 0205-isomorphic-strings.java} | 0 ...chedule.java => 0207-course-schedule.java} | 0 ...a => 0208-implement-trie-prefix-tree.java} | 0 ...e-II.java => 0210-course-schedule-ii.java} | 0 ...-add-and-search-words-data-structure.java} | 0 ...earch-II.java => 0212-word-search-ii.java} | 0 ...bber-II.java => 0213-house-robber-ii.java} | 0 ...0215-kth-largest-element-in-an-array.java} | 0 ...cate.java => 0217-contains-duplicate.java} | 0 ...Tree.java => 0226-invert-binary-tree.java} | 0 ...> 0230-kth-smallest-element-in-a-bst.java} | 0 ...mon-ancestor-of-a-binary-search-tree.java} | 0 ...=> 0238-product-of-array-except-self.java} | 0 ....java => 0239-sliding-window-maximum.java} | 0 ...d-Anagram.java => 0242-valid-anagram.java} | 0 ...-Rooms-ii.java => 0253-meeting-rooms.java} | 0 ...d-Tree.java => 0261-graph-valid-tree.java} | 0 ...g-Number.java => 0268-missing-number.java} | 0 ...ionary.java => 0269-alien-dictionary.java} | 0 ...va => 0271-encode-and-decode-strings.java} | 0 ...Squares.java => 0279-perfect-squares.java} | 0 ...d-Gates.java => 0286-walls-and-gates.java} | 0 ...va => 0287-find-the-duplicate-number.java} | 0 ...90-word-pattern => 0290-word-pattern.java} | 0 ...=> 0295-find-median-from-data-stream.java} | 0 ...erialize-and-deserialize-binary-tree.java} | 0 ... 0300-longest-increasing-subsequence.java} | 0 ...-to-buy-and-sell-stock-with-cooldown.java} | 0 ...Balloons.java => 0312-burst-balloons.java} | 0 ...Coin-Change.java => 0322-coin-change.java} | 0 ...ed-components-in-an-undirected-graph.java} | 0 ...-longest-increasing-path-in-a-matrix.java} | 0 ...y.java => 0332-reconstruct-itinerary.java} | 0 ...ting-Bits.java => 0338-counting-bits.java} | 0 ...java => 0347-top-k-frequent-elements.java} | 0 ...-Twitter.java => 0355-design-twitter.java} | 0 ...ers.java => 0371-sum-of-two-integers.java} | 0 ...a => 0380-insert-delete-getrandom-o1.java} | 0 ...sequence.java => 0392-is-subsequence.java} | 0 ...a => 0416-partition-equal-subset-sum.java} | 0 ... => 0417-pacific-atlantic-water-flow.java} | 0 ...gest-repeating-character-replacement.java} | 0 ...va => 0435-non-overlapping-intervals.java} | 0 ...-all-numbers-disappeared-in-an-array.java} | 0 ...4-Target-Sum.java => 0494-target-sum.java} | 0 ....java => 0496-next-greater-element-i.java} | 0 ... => 0513-find-bottom-left-tree-value.java} | 0 ...Change-2.java => 0518-coin-change-ii.java} | 0 ...java => 0523-continuous-subarray-sum.java} | 0 ...java => 0543-diameter-of-binary-tree.java} | 0 ...K.java => 0560-subarray-sum-equals-k.java} | 0 ...g.java => 0567-permutation-in-string.java} | 0 ...java => 0572-subtree-of-another-tree.java} | 0 ....java => 0617-merge-two-binary-trees.java} | 0 ...cheduler.java => 0621-task-scheduler.java} | 0 ....java => 0647-palindromic-substrings.java} | 0 ...ava => 0678-valid-parenthesis-string.java} | 0 ...on.java => 0684-redundant-connection.java} | 0 ...land.java => 0695-max-area-of-island.java} | 0 ...0703-kth-largest-element-in-a-stream.java} | 0 ...ry-Search.java => 0704-binary-search.java} | 0 ...Pivot-Index => 0724-find-pivot-index.java} | 0 ...ures.java => 0739-daily-temperatures.java} | 0 ...Time.java => 0743-network-delay-time.java} | 0 ...ava => 0746-min-cost-climbing-stairs.java} | 0 ...-the-lock.java => 0752-open-the-lock.java} | 0 ...Labels.java => 0763-partition-labels.java} | 0 ...tring.java => 0767-reorganize-string.java} | 0 ...er.java => 0778-swim-in-rising-water.java} | 0 ...0787-cheapest-flights-within-k-stops.java} | 0 ...ights.java => 0846-hand-of-straights.java} | 0 ...853-Car Fleet.java => 0853-car-fleet.java} | 0 ...nas.java => 0875-koko-eating-bananas.java} | 0 ....java => 0929-unique-email-addresses.java} | 0 ...a => 0973-k-closest-points-to-origin.java} | 0 ...a => 0981-time-based-key-value-store.java} | 0 ...Oranges.java => 0994-rotting-oranges.java} | 0 java/1046-last-stone-weight.java | 13 + java/1143-longest-common-subsequence.java | 54 + ...s => 1189-maximum-number-of-balloons.java} | 0 ...s-with-greatest-element-on-right-side.java | 11 + .../1448-count-good-nodes-in-binary-tree.java | 17 + java/1584-min-cost-to-connect-all-points.java | 36 + ...inimum-interval-to-include-each-query.java | 92 + ...-the-kth-largest-integer-in-the-array.java | 32 + java/2013-detect-squares.java | 110 + javascript/{1-Two-Sum.js => 0001-two-sum.js} | 0 ...Two-Numbers.js => 0002-add-two-numbers.js} | 0 ...substring-without-repeating-characters.js} | 0 ...js => 0004-median-of-two-sorted-arrays.js} | 0 ... => 0005-longest-palindromic-substring.js} | 0 ...rse-Integer.js => 0007-reverse-integer.js} | 0 ...me-Number.js => 0009-palindrome-number.js} | 0 ...js => 0010-regular-expression-matching.js} | 0 ...r.js => 0011-container-with-most-water.js} | 0 ...to-Integer.js => 0013-roman-to-integer.js} | 0 ...refix.js => 0014-longest-common-prefix.js} | 0 javascript/{15-3Sum.js => 0015-3sum.js} | 0 ...-letter-combinations-of-a-phone-number.js} | 0 ... 0019-remove-nth-node-from-end-of-list.js} | 0 ...rentheses.js => 0020-valid-parentheses.js} | 0 ...ists.js => 0021-merge-two-sorted-lists.js} | 0 ...theses.js => 0022-generate-parentheses.js} | 0 ...-Lists.js => 0023-merge-k-sorted-lists.js} | 0 ...up.js => 0025-reverse-nodes-in-k-group.js} | 0 ...26-remove-duplicates-from-sorted-array.js} | 0 ...move-Element.js => 0027-remove-element.js} | 0 ...=> 0033-search-in-rotated-sorted-array.js} | 0 ...tion.js => 0035-search-insert-position.js} | 0 ...6-Valid-Sudoku.js => 0036-valid-sudoku.js} | 0 ...ination-Sum.js => 0039-combination-sum.js} | 0 ...n-Sum-II.js => 0040-combination-sum-ii.js} | 0 ...n-Water.js => 0042-trapping-rain-water.js} | 0 ...ly-Strings.js => 0043-multiply-strings.js} | 0 ...5-Jump-Game-II.js => 0045-jump-game-ii.js} | 0 ...6-Permutations.js => 0046-permutations.js} | 0 ...8-Rotate-Image.js => 0048-rotate-image.js} | 0 ...oup-Anagrams.js => 0049-group-anagrams.js} | 0 .../{51-solveNQueens.js => 0051-n-queens.js} | 0 ...52-totalNQueens.js => 0052-n-queens-ii.js} | 0 ...m-Subarray.js => 0053-maximum-subarray.js} | 0 ...Spiral-Matrix.js => 0054-spiral-matrix.js} | 0 .../{55-Jump-Game.js => 0055-jump-game.js} | 0 ...e-Intervals.js => 0056-merge-intervals.js} | 0 ...rt-Interval.js => 0057-insert-interval.js} | 0 ...st-Word.js => 0058-length-of-last-word.js} | 0 ...2-Unique-Paths.js => 0062-unique-paths.js} | 0 .../{66-plus-one.js => 0066-plus-one.js} | 0 ...bing-Stairs.js => 0070-climbing-stairs.js} | 0 ...Edit-Distance.js => 0072-edit-distance.js} | 0 ...ix-Zeroes.js => 0073-set-matrix-zeroes.js} | 0 ...D-Matrix.js => 0074-search-a-2d-matrix.js} | 0 ...{75-sort-colors.js => 0075-sort-colors.js} | 0 ...ng.js => 0076-minimum-window-substring.js} | 0 javascript/{78-Subsets.js => 0078-subsets.js} | 0 ...{79-Word-Search.js => 0079-word-search.js} | 0 ...083-remove-duplicates-from-sorted-list.js} | 0 ...=> 0084-largest-rectangle-in-histogram.js} | 0 ...ed-Array.js => 0088-merge-sorted-array.js} | 0 .../{90-Subsets-II.js => 0090-subsets-ii.js} | 0 ...{91-Decode-Ways.js => 0091-decode-ways.js} | 0 ...t-II.js => 0092-reverse-linked-list-ii.js} | 0 ... => 0094-binary-tree-inorder-traversal.js} | 0 ...-String.js => 0097-interleaving-string.js} | 0 ...js => 0098-validate-binary-search-tree.js} | 0 .../{100-Same-Tree.js => 0100-same-tree.js} | 0 ...0102-binary-tree-level-order-traversal.js} | 0 ...s => 0104-maximum-depth-of-binary-tree.js} | 0 ...ee-from-preorder-and-inorder-traversal.js} | 0 ...ert-sorted-array-to-binary-search-tree.js} | 0 ...y-Tree.js => 0110-balanced-binary-tree.js} | 0 .../{112-Path-Sum.js => 0112-path-sum.js} | 0 ...ences.js => 0115-distinct-subsequences.js} | 0 ...s-Triangle.js => 0118-pascals-triangle.js} | 0 ...> 0121-best-time-to-buy-and-sell-stock.js} | 0 ...122-best-time-to-buy-and-sell-stock-ii.js} | 0 ...s => 0124-binary-tree-maximum-path-sum.js} | 0 ...Palindrome.js => 0125-valid-palindrome.js} | 0 ...127-Word-Ladder.js => 0127-word-ladder.js} | 0 ...s => 0128-longest-consecutive-sequence.js} | 0 ...-Regions.js => 0130-surrounded-regions.js} | 0 ...ing.js => 0131-palindrome-partitioning.js} | 0 ...133-Clone-Graph.js => 0133-clone-graph.js} | 0 ...134-Gas-Station.js => 0134-gas-station.js} | 0 ...Single-Number.js => 0136-single-number.js} | 0 ... => 0138-copy-list-with-random-pointer.js} | 0 .../{139-Word-Break.js => 0139-word-break.js} | 0 ...ist-Cycle.js => 0141-linked-list-cycle.js} | 0 ...3-Reorder-List.js => 0143-reorder-list.js} | 0 .../{146-LRU-Cache.js => 0146-lru-cache.js} | 0 ... 0150-evaluate-reverse-polish-notation.js} | 0 ...ay.js => 0152-maximum-product-subarray.js} | 0 ...3-find-minimum-in-rotated-sorted-array.js} | 0 .../{155-Min-Stack.js => 0155-min-stack.js} | 0 ... 0160-intersection-of-two-linked-lists.js} | 0 ... 0167-two-sum-ii-input-array-is-sorted.js} | 0 ...ty-element.js => 0169-majority-element.js} | 0 ...js => 0173-binary-search-tree-iterator.js} | 0 ...0-Reverse-Bits.js => 0190-reverse-bits.js} | 0 ...-of-1-bits.js => 0191-number-of-1-bits.js} | 0 ...8-House-Robber.js => 0198-house-robber.js} | 0 ...js => 0199-binary-tree-right-side-view.js} | 0 ...f-Islands.js => 0200-number-of-islands.js} | 0 ...2-Happy-Number.js => 0202-happy-number.js} | 0 ...js => 0203-remove-linked-list-elements.js} | 0 ...-Strings.js => 0205-isomorphic-strings.js} | 0 ...ed-List.js => 0206-reverse-linked-list.js} | 0 ...se-Schedule.js => 0207-course-schedule.js} | 0 ....js => 0208-implement-trie-prefix-tree.js} | 0 ...edule-II.js => 0210-course-schedule-ii.js} | 0 ...gn-add-and-search-words-data-structure.js} | 0 ...rd-Search-ii.js => 0212-word-search-ii.js} | 0 ...e-Robber-II.js => 0213-house-robber-ii.js} | 0 ...> 0215-kth-largest-element-in-an-array.js} | 0 ...uplicate.js => 0217-contains-duplicate.js} | 0 ...ary-Tree.js => 0226-invert-binary-tree.js} | 0 ... => 0230-kth-smallest-element-in-a-bst.js} | 0 ...List.js => 0234-palindrome-linked-list.js} | 0 ...ommon-ancestor-of-a-binary-search-tree.js} | 0 ...s => 0238-product-of-array-except-self.js} | 0 ...imum.js => 0239-sliding-window-maximum.js} | 0 ...Valid-Anagram.js => 0242-valid-anagram.js} | 0 ...ting-Rooms-ii.js => 0253-meeting-rooms.js} | 0 ...Valid-Tree.js => 0261-graph-valid-tree.js} | 0 ...ssing-Number.js => 0268-missing-number.js} | 0 ...Dictionary.js => 0269-alien-dictionary.js} | 0 ...s.js => 0271-encode-and-decode-strings.js} | 0 ...283-Move-Zeroes.js => 0283-move-zeroes.js} | 0 ...s-And-Gates.js => 0286-walls-and-gates.js} | 0 ...r.js => 0287-find-the-duplicate-number.js} | 0 ...0-word-pattern.js => 0290-word-pattern.js} | 0 ...s => 0295-find-median-from-data-stream.js} | 0 ...-serialize-and-deserialize-binary-tree.js} | 0 ...=> 0300-longest-increasing-subsequence.js} | 0 ...me-to-buy-and-sell-stock-with-cooldown.js} | 0 ...rst-Balloons.js => 0312-burst-balloons.js} | 0 ...322-Coin-Change.js => 0322-coin-change.js} | 0 ...cted-components-in-an-undirected-graph.js} | 0 ...29-longest-increasing-path-in-a-matrix.js} | 0 ...erary.js => 0332-reconstruct-itinerary.js} | 0 ...Counting-Bits.js => 0338-counting-bits.js} | 0 ...verse-String.js => 0344-reverse-string.js} | 0 ...nts.js => 0347-top-k-frequent-elements.js} | 0 ...sign-Twitter.js => 0355-design-twitter.js} | 0 ...Square.js => 0367-valid-perfect-square.js} | 0 ...ntegers.js => 0371-sum-of-two-integers.js} | 0 ...-Subsequence.js => 0392-is-subsequence.js} | 0 ....js => 0416-partition-equal-subset-sum.js} | 0 ...js => 0417-pacific-atlantic-water-flow.js} | 0 ...ongest-repeating-character-replacement.js} | 0 ...s.js => 0435-non-overlapping-intervals.js} | 0 ...nd-all-numbers-disappeared-in-an-array.js} | 0 ...quare.js => 0473-matchsticks-to-square.js} | 0 .../{494-Target-Sum.js => 0494-target-sum.js} | 0 ...oin-Change-2.js => 0518-coin-change-ii.js} | 0 ...l.js => 0535-encode-and-decode-tinyurl.js} | 0 ...ree.js => 0543-diameter-of-binary-tree.js} | 0 .../{554-brick-wall.js => 0554-brick-wall.js} | 0 ...tring.js => 0567-permutation-in-string.js} | 0 ...ree.js => 0572-subtree-of-another-tree.js} | 0 ...e-flowers.js => 0605-can-place-flowers.js} | 0 ...rees.js => 0617-merge-two-binary-trees.js} | 0 ...sk-Scheduler.js => 0621-task-scheduler.js} | 0 ...ings.js => 0647-palindromic-substrings.js} | 0 ...e.js => 0669-trim-a-binary-search-tree.js} | 0 ...ng.js => 0678-valid-parenthesis-string.js} | 0 ...ection.js => 0684-redundant-connection.js} | 0 ...f-Island.js => 0695-max-area-of-island.js} | 0 ...> 0703-kth-largest-element-in-a-stream.js} | 0 ...Binary-Search.js => 0704-binary-search.js} | 0 ...ivot-Index.js => 0724-find-pivot-index.js} | 0 ...eratures.js => 0739-daily-temperatures.js} | 0 ...lay-Time.js => 0743-network-delay-time.js} | 0 ...rs.js => 0746-min-cost-climbing-stairs.js} | 0 ...ion-Labels.js => 0763-partition-labels.js} | 0 ...-Water.js => 0778-swim-in-rising-water.js} | 0 ...> 0787-cheapest-flights-within-k-stops.js} | 0 ...Straights.js => 0846-hand-of-straights.js} | 0 .../{853-Car-Fleet.js => 0853-car-fleet.js} | 0 ...Bananas.js => 0875-koko-eating-bananas.js} | 0 ...sses.js => 0929-unique-email-addresses.js} | 0 ....js => 0973-k-closest-points-to-origin.js} | 0 ....js => 0981-time-based-key-value-store.js} | 0 ...ing-Oranges.js => 0994-rotting-oranges.js} | 0 javascript/1046-last-stone-weight.js | 33 + javascript/1143-longest-common-subsequence.js | 144 + ...ve-all-adjacent-duplicates-in-string-ii.js | 22 + ...nts-with-greatest-element-on-right-side.js | 56 + .../1448-count-good-nodes-in-binary-tree.js | 59 + .../1584-min-cost-to-connect-all-points.js | 70 + ...-between-highest-and-lowest-of-k-scores.js | 30 + ...of-pairs-of-interchangeable-rectangles.js} | 0 javascript/2013-detect-squares.js | 52 + ...7-Serialize-and-Deserialize-Binary-Tree.js | 85 - kotlin/{1-Two-Sum.kt => 0001-two-sum.kt} | 0 ...Two-Numbers.kt => 0002-add-two-numbers.kt} | 0 ...substring-without-repeating-characters.kt} | 0 ...kt => 0004-median-of-two-sorted-arrays.kt} | 0 ...rse-Integer.kt => 0007-reverse-integer.kt} | 0 ...r.kt => 0011-container-with-most-water.kt} | 0 kotlin/{15-3Sum.kt => 0015-3sum.kt} | 0 ... 0019-remove-nth-node-from-end-of-list.kt} | 0 ...rentheses.kt => 0020-valid-parentheses.kt} | 0 ...ists.kt => 0021-merge-two-sorted-lists.kt} | 0 ...theses.kt => 0022-generate-parentheses.kt} | 0 ...-Lists.kt => 0023-merge-k-sorted-lists.kt} | 0 ...up.kt => 0025-reverse-nodes-in-k-group.kt} | 0 ...=> 0033-search-in-rotated-sorted-array.kt} | 0 ...6-Valid-Sudoku.kt => 0036-valid-sudoku.kt} | 0 ...ination-Sum.kt => 0039-combination-sum.kt} | 0 ...tion-Sum.kt => 0040-combination-sum-ii.kt} | 0 ...n-Water.kt => 0042-trapping-rain-water.kt} | 0 ...5-Jump-Game-II.kt => 0045-jump-game-ii.kt} | 0 ...6-Permutations.kt => 0046-permutations.kt} | 0 ...oup-Anagrams.kt => 0049-group-anagrams.kt} | 0 ...m-Subarray.kt => 0053-maximum-subarray.kt} | 0 ...Spiral-Matrix.kt => 0054-spiral-matrix.kt} | 0 kotlin/{55-Jump-Game.kt => 0055-jump-game.kt} | 0 ...e-Intervals.kt => 0056-merge-intervals.kt} | 0 ...2-Unique-Paths.kt => 0062-unique-paths.kt} | 0 kotlin/{66-Plus-One.kt => 0066-plus-one.kt} | 0 ...bing-Stairs.kt => 0070-climbing-stairs.kt} | 0 ...rix-Zeros.kt => 0073-set-matrix-zeroes.kt} | 0 ...D-Matrix.kt => 0074-search-a-2d-matrix.kt} | 0 ...{75-Sort-Colors.kt => 0075-sort-colors.kt} | 0 ...ng.kt => 0076-minimum-window-substring.kt} | 0 kotlin/{78-Subsets.kt => 0078-subsets.kt} | 0 ...{79-Word-Search.kt => 0079-word-search.kt} | 0 ...=> 0084-largest-rectangle-in-histogram.kt} | 0 .../{90-Subsets-II.kt => 0090-subsets-ii.kt} | 0 ...{91-Decode-Ways.kt => 0091-decode-ways.kt} | 0 ...kt => 0098-validate-binary-search-tree.kt} | 0 .../{100-Same-Tree.kt => 0100-same-tree.kt} | 0 ...0102-binary-tree-level-order-traversal.kt} | 0 ...t => 0104-maximum-depth-of-binary-tree.kt} | 0 ...ee-from-preorder-and-inorder-traversal.kt} | 0 ...y-Tree.kt => 0110-balanced-binary-tree.kt} | 0 ...> 0121-best-time-to-buy-and-sell-stock.kt} | 0 ...t => 0124-binary-tree-maximum-path-sum.kt} | 0 ...Palindrome.kt => 0125-valid-palindrome.kt} | 0 ...127-Word-Ladder.kt => 0127-word-ladder.kt} | 0 ...t => 0128-longest-consecutive-sequence.kt} | 0 ...-Regions.kt => 0130-surrounded-regions.kt} | 0 ...134-Gas-Station.kt => 0134-gas-station.kt} | 0 ...Single-Number.kt => 0136-single-number.kt} | 0 ... => 0138-copy-list-with-random-pointer.kt} | 0 ...ist-Cycle.kt => 0141-linked-list-cycle.kt} | 0 ...3-Reorder-List.kt => 0143-reorder-list.kt} | 0 .../{146-LRU-Cache.kt => 0146-lru-cache.kt} | 0 ... 0150-evaluate-reverse-polish-notation.kt} | 0 ...ay.kt => 0152-maximum-product-subarray.kt} | 0 ...3-find-minimum-in-rotated-sorted-array.kt} | 0 .../{155-Min-Stack.kt => 0155-min-stack.kt} | 0 ... 0167-two-sum-ii-input-array-is-sorted.kt} | 0 ...0-Reverse-Bits.kt => 0190-reverse-bits.kt} | 0 ...-Of-1-Bits.kt => 0191-number-of-1-bits.kt} | 0 ...8-House-Robber.kt => 0198-house-robber.kt} | 0 ...kt => 0199-binary-tree-right-side-view.kt} | 0 ...f-Islands.kt => 0200-number-of-islands.kt} | 0 ...2-Happy-Number.kt => 0202-happy-number.kt} | 0 ...ed-List.kt => 0206-reverse-linked-list.kt} | 0 ...se-Schedule.kt => 0207-course-schedule.kt} | 0 ....kt => 0208-implement-trie-prefix-tree.kt} | 0 ...gn-add-and-search-words-data-structure.kt} | 0 ...rd-Search-II.kt => 0212-word-search-ii.kt} | 0 ...e-Robber-II.kt => 0213-house-robber-ii.kt} | 0 ...> 0215-kth-largest-element-in-an-array.kt} | 0 ...uplicate.kt => 0217-contains-duplicate.kt} | 0 ...ary-Tree.kt => 0226-invert-binary-tree.kt} | 0 ... => 0230-kth-smallest-element-in-a-bst.kt} | 0 ...ommon-ancestor-of-a-binary-search-tree.kt} | 0 ...t => 0238-product-of-array-except-self.kt} | 0 ...imum.kt => 0239-sliding-window-maximum.kt} | 0 ...Valid-Anagram.kt => 0242-valid-anagram.kt} | 0 ...ssing-Number.kt => 0268-missing-number.kt} | 0 ...r.kt => 0287-find-the-duplicate-number.kt} | 0 ...t => 0295-find-median-from-data-stream.kt} | 0 ...-serialize-and-deserialize-binary-tree.kt} | 0 ...me-to-buy-and-sell-stock-with-cooldown.kt} | 0 ...322-Coin-Change.kt => 0322-coin-change.kt} | 0 ...29-longest-increasing-path-in-a-matrix.kt} | 0 ...erary.kt => 0332-reconstruct-itinerary.kt} | 0 ...Counting-Bits.kt => 0338-counting-bits.kt} | 0 ...nts.kt => 0347-top-k-frequent-elements.kt} | 0 ...ntegers.kt => 0371-sum-of-two-integers.kt} | 0 ...kt => 0417-pacific-atlantic-water-flow.kt} | 0 ...ongest-repeating-character-replacement.kt} | 0 ...ree.kt => 0543-diameter-of-binary-tree.kt} | 0 ...tring.kt => 0567-permutation-in-string.kt} | 0 ...ree.kt => 0572-subtree-of-another-tree.kt} | 0 ...ection.kt => 0684-redundant-connection.kt} | 0 ...f-Island.kt => 0695-max-area-of-island.kt} | 0 ...Binary-Search.kt => 0704-binary-search.kt} | 0 ...eratures.kt => 0739-daily-temperatures.kt} | 0 ...rs.kt => 0746-min-cost-climbing-stairs.kt} | 0 ...> 0787-cheapest-flights-within-k-stops.kt} | 0 .../{853-Car-Fleet.kt => 0853-car-fleet.kt} | 0 ...Bananas.kt => 0875-koko-eating-bananas.kt} | 0 ....kt => 0973-k-closest-points-to-origin.kt} | 0 ....kt => 0981-time-based-key-value-store.kt} | 0 ...ing-Oranges.kt => 0994-rotting-oranges.kt} | 0 kotlin/1046-last-stone-weight.kt | 23 + kotlin/1143-longest-common-subsequence.kt | 23 + .../1448-count-good-nodes-in-binary-tree.kt | 29 + python/{1-Two-Sum.py => 0001-two-sum.py} | 0 ...Two-Numbers.py => 0002-add-two-numbers.py} | 0 ...substring-without-repeating-characters.py} | 0 ...py => 0004-median-of-two-sorted-arrays.py} | 0 ... => 0005-longest-palindromic-substring.py} | 0 ...rse-Integer.py => 0007-reverse-integer.py} | 0 ...py => 0010-regular-expression-matching.py} | 0 ...r.py => 0011-container-with-most-water.py} | 0 ...r-To-Roman.py => 0012-integer-to-roman.py} | 0 ...To-Integer.py => 0013-roman-to-integer.py} | 0 ...refix.py => 0014-longest-common-prefix.py} | 0 python/{15-3Sum.py => 0015-3sum.py} | 0 ...-letter-combinations-of-a-phone-number.py} | 0 python/{18-4Sum.py => 0018-4sum.py} | 0 ... 0019-remove-nth-node-from-end-of-list.py} | 0 ...rentheses.py => 0020-valid-parentheses.py} | 0 ...ists.py => 0021-merge-two-sorted-lists.py} | 0 ...theses.py => 0022-generate-parentheses.py} | 0 ...-Lists.py => 0023-merge-k-sorted-lists.py} | 0 ...n-Pairs.py => 0024-swap-nodes-in-pairs.py} | 0 ...up.py => 0025-reverse-nodes-in-k-group.py} | 0 ...26-remove-duplicates-from-sorted-array.py} | 0 ...move-Element.py => 0027-remove-element.py} | 0 ...ex-of-the-first-occurrence-in-a-string.py} | 0 ...=> 0033-search-in-rotated-sorted-array.py} | 0 ...st-position-of-element-in-sorted-array.py} | 0 ...tion.py => 0035-search-insert-position.py} | 0 ...6-Valid-Sudoku.py => 0036-valid-sudoku.py} | 0 ...ination-Sum.py => 0039-combination-sum.py} | 0 ...n-Sum-II.py => 0040-combination-sum-ii.py} | 0 ...tive.py => 0041-first-missing-positive.py} | 0 ...n-Water.py => 0042-trapping-rain-water.py} | 0 ...ly-Strings.py => 0043-multiply-strings.py} | 0 ...5-Jump-Game-II.py => 0045-jump-game-ii.py} | 0 ...6-Permutations.py => 0046-permutations.py} | 0 ...8-Rotate-Image.py => 0048-rotate-image.py} | 0 ...oup-Anagrams.py => 0049-group-anagrams.py} | 0 python/{50-Pow(x, n).py => 0050-powx-n.py} | 0 python/{51-N-Queens.py => 0051-n-queens.py} | 0 ...m-Subarray.py => 0053-maximum-subarray.py} | 0 ...Spiral-Matrix.py => 0054-spiral-matrix.py} | 0 python/{55-Jump-Game.py => 0055-jump-game.py} | 0 ...e-Intervals.py => 0056-merge-intervals.py} | 0 ...rt-Interval.py => 0057-insert-interval.py} | 0 ...st-Word.py => 0058-length-of-last-word.py} | 0 ...2-Unique-Paths.py => 0062-unique-paths.py} | 0 ...m-Path-Sum.py => 0064-minimum-path-sum.py} | 0 python/{66-Plus-One.py => 0066-plus-one.py} | 0 ...bing-Stairs.py => 0070-climbing-stairs.py} | 0 ...Simplify-Path.py => 0071-simplify-path.py} | 0 ...Edit-Distance.py => 0072-edit-distance.py} | 0 ...ix-Zeroes.py => 0073-set-matrix-zeroes.py} | 0 ...D-Matrix.py => 0074-search-a-2d-matrix.py} | 0 ...ng.py => 0076-minimum-window-substring.py} | 0 ...7-Combinations.py => 0077-combinations.py} | 0 python/{78-Subsets.py => 0078-subsets.py} | 0 ...{79-Word-Search.py => 0079-word-search.py} | 0 ...083-remove-duplicates-from-sorted-list.py} | 0 ...=> 0084-largest-rectangle-in-histogram.py} | 0 .../{90-Subsets-II.py => 0090-subsets-ii.py} | 0 ...{91-Decode-ways.py => 0091-decode-ways.py} | 0 ...t-II.py => 0092-reverse-linked-list-ii.py} | 0 ... => 0094-binary-tree-inorder-traversal.py} | 0 ...Strings.py => 0097-interleaving-string.py} | 0 ...py => 0098-validate-binary-search-tree.py} | 0 .../{100-Same-Tree.py => 0100-same-tree.py} | 0 ...0102-binary-tree-level-order-traversal.py} | 0 ...y => 0104-maximum-depth-of-binary-tree.py} | 0 ...ee-from-preorder-and-inorder-traversal.py} | 0 ...y-Tree.py => 0110-balanced-binary-tree.py} | 0 ...ences.py => 0115-distinct-subsequences.py} | 0 ...l-Triangle.py => 0118-pascals-triangle.py} | 0 python/{120-Triangle.py => 0120-triangle.py} | 0 ...> 0121-best-time-to-buy-and-sell-stock.py} | 0 ...y => 0124-binary-tree-maximum-path-sum.py} | 0 ...Palindrome.py => 0125-valid-palindrome.py} | 0 ...127-Word-Ladder.py => 0127-word-ladder.py} | 0 ...y => 0128-longest-consecutive-sequence.py} | 0 ...-Regions.py => 0130-surrounded-regions.py} | 0 ...ing.py => 0131-palindrome-partitioning.py} | 0 ...133-Clone-Graph.py => 0133-clone-graph.py} | 0 ...134-Gas-Station.py => 0134-gas-station.py} | 0 ...Single-Number.py => 0136-single-number.py} | 0 ... => 0138-copy-list-with-random-pointer.py} | 0 .../{139-Word-Break.py => 0139-word-break.py} | 0 ...ist-Cycle.py => 0141-linked-list-cycle.py} | 0 ...3-Reorder-List.py => 0143-reorder-list.py} | 0 .../{146-LRU-Cache.py => 0146-lru-cache.py} | 0 ... 0150-evaluate-reverse-polish-notation.py} | 0 ...ay.py => 0152-maximum-product-subarray.py} | 0 ...3-find-minimum-in-rotated-sorted-array.py} | 0 .../{155-Min-Stack.py => 0155-min-stack.py} | 0 ... 0160-intersection-of-two-linked-lists.py} | 0 ... 0167-two-sum-ii-input-array-is-sorted.py} | 0 ...ty-Element.py => 0169-majority-element.py} | 0 ...0-Reverse-Bits.py => 0190-reverse-bits.py} | 0 ...-of-1-Bits.py => 0191-number-of-1-bits.py} | 0 ...8-House-Robber.py => 0198-house-robber.py} | 0 ...py => 0199-binary-tree-right-side-view.py} | 0 ...f-Islands.py => 0200-number-of-islands.py} | 0 ...2-Happy-Number.py => 0202-happy-number.py} | 0 ...-Strings.py => 0205-isomorphic-strings.py} | 0 ...ed-List.py => 0206-reverse-linked-list.py} | 0 ...se-Schedule.py => 0207-course-schedule.py} | 0 ....py => 0208-implement-trie-prefix-tree.py} | 0 ...edule-II.py => 0210-course-schedule-ii.py} | 0 ...gn-add-and-search-words-data-structure.py} | 0 ...rd-Search-II.py => 0212-word-search-ii.py} | 0 ...e-Robber-II.py => 0213-house-robber-ii.py} | 0 ...> 0215-kth-largest-element-in-an-array.py} | 0 ...uplicate.py => 0217-contains-duplicate.py} | 0 ...ximal-Square.py => 0221-maximal-square.py} | 0 ...ary-Tree.py => 0226-invert-binary-tree.py} | 0 ... => 0230-kth-smallest-element-in-a-bst.py} | 0 ...ommon-ancestor-of-a-binary-search-tree.py} | 0 ...y => 0238-product-of-array-except-self.py} | 0 ...imum.py => 0239-sliding-window-maximum.py} | 0 ...alid-Anagrams.py => 0242-valid-anagram.py} | 0 ...ting-Rooms-ii.py => 0253-meeting-rooms.py} | 0 ...Valid-Tree.py => 0261-graph-valid-tree.py} | 0 ...ssing-Number.py => 0268-missing-number.py} | 0 ...Dictionary.py => 0269-alien-dictionary.py} | 0 ...s.py => 0271-encode-and-decode-strings.py} | 0 ...s-and-Gates.py => 0286-walls-and-gates.py} | 0 ...r.py => 0287-find-the-duplicate-number.py} | 0 ...0-Word-Pattern.py => 0290-word-pattern.py} | 0 ...y => 0295-find-median-from-data-stream.py} | 0 ...-serialize-and-deserialize-binary-tree.py} | 0 ...=> 0300-longest-increasing-subsequence.py} | 0 ...me-to-buy-and-sell-stock-with-cooldown.py} | 0 ...rst-Balloons.py => 0312-burst-balloons.py} | 0 ...322-Coin-Change.py => 0322-coin-change.py} | 0 ...cted-components-in-an-undirected-graph.py} | 0 ...29-longest-increasing-path-in-a-matrix.py} | 0 ...erary.py => 0332-reconstruct-itinerary.py} | 0 ...Counting-Bits.py => 0338-counting-bits.py} | 0 ...verse-String.py => 0344-reverse-string.py} | 0 ...nts.py => 0347-top-k-frequent-elements.py} | 0 ...sign-Twitter.py => 0355-design-twitter.py} | 0 ...Square.py => 0367-valid-perfect-square.py} | 0 ...ntegers.py => 0371-sum-of-two-integers.py} | 0 ...y => 0374-guess-number-higher-or-lower.py} | 0 ...n-Sum-IV.py => 0377-combination-sum-iv.py} | 0 ...-Subsequence.py => 0392-is-subsequence.py} | 0 ...decode-string.py => 0394-decode-string.py} | 0 ...Sum.py => 0410-split-array-largest-sum.py} | 0 ....py => 0416-partition-equal-subset-sum.py} | 0 ...py => 0417-pacific-atlantic-water-flow.py} | 0 ...ongest-repeating-character-replacement.py} | 0 ...s.py => 0435-non-overlapping-intervals.py} | 0 ... => 0438-find-all-anagrams-in-a-string.py} | 0 ...anging-Coin.py => 0441-arranging-coins.py} | 0 ...nd-all-numbers-disappeared-in-an-array.py} | 0 ...-Perimeter.py => 0463-island-perimeter.py} | 0 ...quare.py => 0473-matchsticks-to-square.py} | 0 .../{494-Target-Sum.py => 0494-target-sum.py} | 0 ...nt-I.py => 0496-next-greater-element-i.py} | 0 ...oin-change-2.py => 0518-coin-change-ii.py} | 0 ...Sum.py => 0523-continuous-subarray-sum.py} | 0 ...ree.py => 0543-diameter-of-binary-tree.py} | 0 ...tring.py => 0567-permutation-in-string.py} | 0 ...ree.py => 0572-subtree-of-another-tree.py} | 0 ...e-Flowers.py => 0605-can-place-flowers.py} | 0 ...rees.py => 0617-merge-two-binary-trees.py} | 0 ...sk-Scheduler.py => 0621-task-scheduler.py} | 0 ...ings.py => 0647-palindromic-substrings.py} | 0 ...nts.py => 0658-find-k-closest-elements.py} | 0 ...e.py => 0669-trim-a-binary-search-tree.py} | 0 ...mber-of-longest-increasing-subsequence.py} | 0 ...ng.py => 0678-valid-parenthesis-string.py} | 0 ...rome-II.py => 0680-valid-palindrome-ii.py} | 0 ...Baseball-Game.py => 0682-baseball-game.py} | 0 ...ection.py => 0684-redundant-connection.py} | 0 ...f-Island.py => 0695-max-area-of-island.py} | 0 ...> 0703-kth-largest-element-in-a-stream.py} | 0 ...Binary-Search.py => 0704-binary-search.py} | 0 ...ivot-Index.py => 0724-find-pivot-index.py} | 0 ...eratures.py => 0739-daily-temperatures.py} | 0 ...lay-Time.py => 0743-network-delay-time.py} | 0 ...rs.py => 0746-min-cost-climbing-stairs.py} | 0 ...Open-the-Lock.py => 0752-open-the-lock.py} | 0 ...ion-Labels.py => 0763-partition-labels.py} | 0 ...ze-String.py => 0767-reorganize-string.py} | 0 ...-Water.py => 0778-swim-in-rising-water.py} | 0 ...> 0787-cheapest-flights-within-k-stops.py} | 0 ...Straights.py => 0846-hand-of-straights.py} | 0 .../{853-Car-Fleet.py => 0853-car-fleet.py} | 0 ...Bananas.py => 0875-koko-eating-bananas.py} | 0 ...tock-Span.py => 0901-online-stock-span.py} | 0 ...-Ladders.py => 0909-snakes-and-ladders.py} | 0 ...g-Rooms-II.py => 0919-meeting-rooms-ii.py} | 0 ...sses.py => 0929-unique-email-addresses.py} | 0 ....py => 0973-k-closest-points-to-origin.py} | 0 ...y.py => 0977-squares-of-a-sorted-array.py} | 0 ....py => 0981-time-based-key-value-store.py} | 0 ...ing-Oranges.py => 0994-rotting-oranges.py} | 0 python/1046-last-stone-weight.py | 13 + python/1143-longest-common-subsequence.py | 12 + python/1189-maximum-number-of-balloons.py | 12 + ...ve-all-adjacent-duplicates-in-string-ii.py | 18 + python/1220-count-vowels-permutation.py | 39 + ...catenated-string-with-unique-characters.py | 27 + ...nts-with-greatest-element-on-right-side.py | 8 + python/1383-maximum-performance-of-a-team.py | 18 + .../1448-count-good-nodes-in-binary-tree.py | 19 + python/1584-min-cost-to-connect-all-points.py | 26 + python/1845-seat-reservation-manager.py | 12 + ...ring-into-descending-consecutive-values.py | 18 + ...-minimum-interval-to-include-each-query.py | 16 + python/1905-count-sub-islands.py | 33 + python/1980-find-unique-binary-string.py | 19 + ...nd-the-kth-largest-integer-in-the-array.py | 8 + python/2013-detect-squares.py | 17 + python/2017-grid-game.py | 12 + ruby/{1-Two-Sum.rb => 0001-two-sum.rb} | 0 ...Two-Numbers.rb => 0002-add-two-numbers.rb} | 0 ...substring-without-repeating-characters.rb} | 0 ...rse-Integer.rb => 0007-reverse-integer.rb} | 0 ...r.rb => 0011-container-with-most-water.rb} | 0 ruby/{15-3Sum.rb => 0015-3sum.rb} | 0 ...-letter-combinations-of-a-phone-number.rb} | 0 ...rentheses.rb => 0020-valid-parentheses.rb} | 0 ...ists.rb => 0021-merge-two-sorted-lists.rb} | 0 ...theses.rb => 0022-generate-parentheses.rb} | 0 ...6-Valid-Sudoku.rb => 0036-valid-sudoku.rb} | 0 ...n-Water.rb => 0042-trapping-rain-water.rb} | 0 ...oup-Anagrams.rb => 0049-group-anagrams.rb} | 0 ruby/0053-maximum-subarray.rb | 13 + ...bing-Stairs.rb => 0070-climbing-stairs.rb} | 0 ...D-Matrix.rb => 0074-search-a-2d-matrix.rb} | 0 ruby/{78-Subsets.rb => 0078-subsets.rb} | 0 ... => 0094-binary-tree-inorder-traversal.rb} | 0 ruby/{100-Same-Tree.rb => 0100-same-tree.rb} | 0 ...0102-binary-tree-level-order-traversal.rb} | 0 ...b => 0104-maximum-depth-of-binary-tree.rb} | 0 ...y-Tree.rb => 0110-balanced-binary-tree.rb} | 0 ...> 0121-best-time-to-buy-and-sell-stock.rb} | 0 ...Palindrome.rb => 0125-valid-palindrome.rb} | 0 ...b => 0128-longest-consecutive-sequence.rb} | 0 ...133-Clone-Graph.rb => 0133-clone-graph.rb} | 0 ...Single-Number.rb => 0136-single-number.rb} | 0 ... => 0138-copy-list-with-random-pointer.rb} | 0 ...ist-Cycle.rb => 0141-linked-list-cycle.rb} | 0 ruby/{146-LRU-Cache.rb => 0146-lru-cache.rb} | 0 ... 0150-evaluate-reverse-polish-notation.rb} | 0 ...ay.rb => 0152-maximum-product-subarray.rb} | 0 ruby/{155-Min-Stack.rb => 0155-min-stack.rb} | 0 ... 0167-two-sum-ii-input-array-is-sorted.rb} | 0 ...0-Reverse-Bits.rb => 0190-reverse-bits.rb} | 0 ...-of-1-Bits.rb => 0191-number-of-1-bits.rb} | 0 ...8-House-Robber.rb => 0198-house-robber.rb} | 0 ...f-Islands.rb => 0200-number-of-islands.rb} | 0 ...ed-List.rb => 0206-reverse-linked-list.rb} | 0 ....rb => 0208-implement-trie-prefix-tree.rb} | 0 ...gn-add-and-search-words-data-structure.rb} | 0 ...e-Robber-II.rb => 0213-house-robber-ii.rb} | 0 ...uplicate.rb => 0217-contains-duplicate.rb} | 0 ...ary-Tree.rb => 0226-invert-binary-tree.rb} | 0 ...ommon-ancestor-of-a-binary-search-tree.rb} | 0 ...b => 0238-product-of-array-except-self.rb} | 0 ...alid-Anagrams.rb => 0242-valid-anagram.rb} | 0 ...ssing-Number.rb => 0268-missing-number.rb} | 0 ...s.rb => 0271-encode-and-decode-strings.rb} | 0 ...r.rb => 0287-find-the-duplicate-number.rb} | 0 ...Counting-Bits.rb => 0338-counting-bits.rb} | 0 ...nts.rb => 0347-top-k-frequent-elements.rb} | 0 ...ntegers.rb => 0371-sum-of-two-integers.rb} | 0 ...ongest-repeating-character-replacement.rb} | 0 ...ree.rb => 0543-diameter-of-binary-tree.rb} | 0 ...ree.rb => 0572-subtree-of-another-tree.rb} | 0 ...> 0703-kth-largest-element-in-a-stream.rb} | 0 ...Binary-Search.rb => 0704-binary-search.rb} | 0 ...eratures.rb => 0739-daily-temperatures.rb} | 0 ...rs.rb => 0746-min-cost-climbing-stairs.rb} | 0 ruby/{853-Car-Fleet.rb => 0853-car-fleet.rb} | 0 ...Bananas.rb => 0875-koko-eating-bananas.rb} | 0 ruby/0981-time-based-key-value-store.rb | 54 + ruby/1046-last-stone-weight.rb | 15 + ruby/1584-min-cost-to-connect-all-points.rb | 33 + rust/{1-Two-Sum.rs => 0001-two-sum.rs} | 0 ...substring-without-repeating-characters.rs} | 0 ... => 0005-longest-palindromic-substring.rs} | 0 ...r.rs => 0011-container-with-most-water.rs} | 0 rust/{15-3sum.rs => 0015-3sum.rs} | 0 ...rentheses.rs => 0020-valid-parentheses.rs} | 0 ...=> 0033-search-in-rotated-sorted-array.rs} | 0 ...6-Valid-Sudoku.rs => 0036-valid-sudoku.rs} | 0 ...oup-Anagrams.rs => 0049-group-anagrams.rs} | 0 ...m-Subarray.rs => 0053-maximum-subarray.rs} | 0 rust/{55-Jump-Game.rs => 0055-jump-game.rs} | 0 ...rt-Interval.rs => 0057-insert-interval.rs} | 0 ...st-Word.rs => 0058-length-of-last-word.rs} | 0 ...2-Unique-Paths.rs => 0062-unique-paths.rs} | 0 ...bing-Stairs.rs => 0070-climbing-stairs.rs} | 0 ...ng.rs => 0076-minimum-window-substring.rs} | 0 ...=> 0084-largest-rectangle-in-histogram.rs} | 0 ...s-Triangle.rs => 0118-pascals-triangle.rs} | 0 ...> 0121-best-time-to-buy-and-sell-stock.rs} | 0 ...Palindrome.rs => 0125-valid-palindrome.rs} | 0 ...s => 0128-longest-consecutive-sequence.rs} | 0 ...ay.rs => 0152-maximum-product-subarray.rs} | 0 ...3-find-minimum-in-rotated-sorted-array.rs} | 0 ... 0167-two-sum-ii-input-array-is-sorted.rs} | 0 ...0-Reverse-Bits.rs => 0190-reverse-bits.rs} | 0 ...-Of-1-Bits.rs => 0191-number-of-1-bits.rs} | 0 ...8-House-Robber.rs => 0198-house-robber.rs} | 0 ....rs => 0208-implement-trie-prefix-tree.rs} | 0 ...gn-add-and-search-words-data-structure.rs} | 0 ...rd-Search-II.rs => 0212-word-search-ii.rs} | 0 ...e-Robber-II.rs => 0213-house-robber-ii.rs} | 0 ...plicates.rs => 0217-contains-duplicate.rs} | 0 ...s => 0238-product-of-array-except-self.rs} | 0 ...Valid-Anagram.rs => 0242-valid-anagram.rs} | 0 ...Meeting-Rooms.rs => 0253-meeting-rooms.rs} | 0 ...ssing-Number.rs => 0268-missing-number.rs} | 0 ...s.rs => 0271-encode-and-decode-strings.rs} | 0 ...322-Coin-Change.rs => 0322-coin-change.rs} | 0 ...Counting-Bits.rs => 0338-counting-bits.rs} | 0 ...nts.rs => 0347-top-k-frequent-elements.rs} | 0 ...ntegers.rs => 0371-sum-of-two-integers.rs} | 0 ...-Subsequence.rs => 0392-is-subsequence.rs} | 0 ...ongest-repeating-character-replacement.rs} | 0 ...ings.rs => 0647-palindromic-substrings.rs} | 0 ...rs.rs => 0746-min-cost-climbing-stairs.rs} | 0 rust/1143-longest-common-subsequence.rs | 18 + ...nts-with-greatest-element-on-right-side.rs | 12 + scala/{1-Two-Sum.scala => 0001-two-sum.scala} | 0 ...mbers.scala => 0002-add-two-numbers.scala} | 0 ...string-without-repeating-characters.scala} | 0 ...teger.scala => 0007-reverse-integer.scala} | 0 scala/{15-3Sum.scala => 0015-3sum.scala} | 0 ...cala => 0021-merge-two-sorted-lists.scala} | 0 ...0033-search-in-rotated-sorted-array.scala} | 0 ...rvals.scala => 0056-merge-intervals.scala} | 0 ...code-Ways.scala => 0091-decode-ways.scala} | 0 ...cle.scala => 0141-linked-list-cycle.scala} | 0 ...ind-minimum-in-rotated-sorted-array.scala} | 0 ...e-Robber.scala => 0198-house-robber.scala} | 0 ...t.scala => 0206-reverse-linked-list.scala} | 0 ...er-II.scala => 0213-house-robber-ii.scala} | 0 ...te.scala => 0217-contains-duplicate.scala} | 0 ...on-ancestor-of-a-binary-search-tree.scala} | 0 ...a => 0435-non-overlapping-intervals.scala} | 0 ...ala => 0572-subtree-of-another-tree.scala} | 0 swift/{1-Two-Sum.swift => 0001-two-sum.swift} | 0 ...mbers.swift => 0002-add-two-numbers.swift} | 0 ...string-without-repeating-characters.swift} | 0 ...teger.swift => 0007-reverse-integer.swift} | 0 ...t => 0011-container-with-most-water.swift} | 0 swift/{15-3Sum.swift => 0015-3sum.swift} | 0 ...19-remove-nth-node-from-end-of-list.swift} | 0 ...rentheses => 0020-valid-parentheses.swift} | 0 ...wift => 0021-merge-two-sorted-lists.swift} | 0 ...0033-search-in-rotated-sorted-array.swift} | 0 ...wift => 0035-search-insert-position.swift} | 0 ...r.swift => 0042-trapping-rain-water.swift} | 0 ...ings.swift => 0043-multiply-strings.swift} | 0 ...-Game-II.swift => 0045-jump-game-ii.swift} | 0 ...utations.swift => 0046-permutations.swift} | 0 ...te-Image.swift => 0048-rotate-image.swift} | 0 ...agrams.swift => 0049-group-anagrams.swift} | 0 .../{50-Pow(x, n).swift => 0050-powx-n.swift} | 0 ...rray.swift => 0053-maximum-subarray.swift} | 0 ...5-Jump-Game.swift => 0055-jump-game.swift} | 0 ...erval.swift => 0057-insert-interval.swift} | 0 ...{66-Plus-One.swift => 0066-plus-one.swift} | 0 ...tairs.swift => 0070-climbing-stairs.swift} | 0 ...istance.swift => 0072-edit-distance.swift} | 0 ...ix.swift => 0074-search-a-2d-matrix.swift} | 0 .../{78-Subsets.swift => 0078-subsets.swift} | 0 ...rd-Search.swift => 0079-word-search.swift} | 0 ...=> 0098-validate-binary-search-tree.swift} | 0 ...0-Same-Tree.swift => 0100-same-tree.swift} | 0 ...2-binary-tree-level-order-traversal.swift} | 0 ...> 0104-maximum-depth-of-binary-tree.swift} | 0 ....swift => 0110-balanced-binary-tree.swift} | 0 ...121-best-time-to-buy-and-sell-stock.swift} | 0 ...> 0124-binary-tree-maximum-path-sum.swift} | 0 ...rome.swift => 0125-valid-palindrome.swift} | 0 ...> 0128-longest-consecutive-sequence.swift} | 0 ...ns.swift => 0130-surrounded-regions.swift} | 0 ...one-Graph.swift => 0133-clone-graph.swift} | 0 ...s-Station.swift => 0134-gas-station.swift} | 0 ...-Number.swift => 0136-single-number.swift} | 0 ... 0138-copy-list-with-random-pointer.swift} | 0 ...cle.swift => 0141-linked-list-cycle.swift} | 0 ...50-evaluate-reverse-polish-notation.swift} | 0 ...ft => 0152-maximum-product-subarray.swift} | 0 ...ind-minimum-in-rotated-sorted-array.swift} | 0 ...67-two-sum-ii-input-array-is-sorted.swift} | 0 ...ment.swift => 0169-majority-element.swift} | 0 ...rse-Bits.swift => 0190-reverse-bits.swift} | 0 ...Bits.swift => 0191-number-of-1-bits.swift} | 0 ...e-Robber.swift => 0198-house-robber.swift} | 0 ...=> 0199-binary-tree-right-side-view.swift} | 0 ...nds.swift => 0200-number-of-islands.swift} | 0 ...y-Number.swift => 0202-happy-number.swift} | 0 ...gs.swift => 0205-isomorphic-strings.swift} | 0 ...t.swift => 0206-reverse-linked-list.swift} | 0 ...edule.swift => 0207-course-schedule.swift} | 0 ... => 0208-implement-trie-prefix-tree.swift} | 0 ...rch-II.swift => 0212-word-search-ii.swift} | 0 ...er-II.swift => 0213-house-robber-ii.swift} | 0 ...te.swift => 0217-contains-duplicate.swift} | 0 ...ary-Tree => 0226-invert-binary-tree.swift} | 0 ... 0230-kth-smallest-element-in-a-bst.swift} | 0 ...on-ancestor-of-a-binary-search-tree.swift} | 0 ...> 0238-product-of-array-except-self.swift} | 0 ...Anagram.swift => 0242-valid-anagram.swift} | 0 ...Tree.swift => 0261-graph-valid-tree.swift} | 0 ...Number.swift => 0268-missing-number.swift} | 0 ...t => 0271-encode-and-decode-strings.swift} | 0 ...t => 0287-find-the-duplicate-number.swift} | 0 ...to-buy-and-sell-stock-with-cooldown.swift} | 0 ...d-components-in-an-undirected-graph.swift} | 0 ...ng-Bits.swift => 0338-counting-bits.swift} | 0 ...String.swift => 0344-reverse-string.swift} | 0 ...ift => 0347-top-k-frequent-elements.swift} | 0 ...s.swift => 0371-sum-of-two-integers.swift} | 0 ...ift => 0543-diameter-of-binary-tree.swift} | 0 ...ift => 0572-subtree-of-another-tree.swift} | 0 ...703-kth-largest-element-in-a-stream.swift} | 0 ...Binary-Search => 0704-binary-search.swift} | 0 ...es.swift => 0739-daily-temperatures.swift} | 0 ...ft => 0746-min-cost-climbing-stairs.swift} | 0 ...s.swift => 0875-koko-eating-bananas.swift} | 0 ...wift => 0929-unique-email-addresses.swift} | 0 swift/1143-longest-common-subsequence.swift | 21 + .../121-Best-Time-to-Buy-and-Sell-Stock.swift | 16 - ...48-Count-Good-Nodes-In-Binary-Tree-2.swift | 19 - ...448-count-good-nodes-in-binary-tree.swift} | 0 .../1584-min-cost-to-connect-all-points.swift | 95 + ...the-kth-largest-integer-in-the-array.swift | 143 + typescript/{1-Two-Sum.ts => 0001-two-sum.ts} | 0 ...Two-Numbers.ts => 0002-add-two-numbers.ts} | 0 ...substring-without-repeating-characters.ts} | 0 ...ts => 0004-median-of-two-sorted-arrays.ts} | 0 ... => 0005-longest-palindromic-substring.ts} | 0 ...rse-Integer.ts => 0007-reverse-integer.ts} | 0 ...me-Number.ts => 0009-palindrome-number.ts} | 0 ...ts => 0010-regular-expression-matching.ts} | 0 ...r.ts => 0011-container-with-most-water.ts} | 0 typescript/{15-3Sum.ts => 0015-3sum.ts} | 0 ...-letter-combinations-of-a-phone-number.ts} | 0 ... 0019-remove-nth-node-from-end-of-list.ts} | 0 ...rentheses.ts => 0020-valid-parentheses.ts} | 0 ...ists.ts => 0021-merge-two-sorted-lists.ts} | 0 ...theses.ts => 0022-generate-parentheses.ts} | 0 ...-Lists.ts => 0023-merge-k-sorted-lists.ts} | 0 ...up.ts => 0025-reverse-nodes-in-k-group.ts} | 0 ...move-Element.ts => 0027-remove-element.ts} | 0 ...=> 0033-search-in-rotated-sorted-array.ts} | 0 ...6-Valid-Sudoku.ts => 0036-valid-sudoku.ts} | 0 ...ination-Sum.ts => 0039-combination-sum.ts} | 0 ...n-Sum-II.ts => 0040-combination-sum-ii.ts} | 0 ...tive.ts => 0041-first-missing-positive.ts} | 0 ...n-Water.ts => 0042-trapping-rain-water.ts} | 0 ...ly-Strings.ts => 0043-multiply-strings.ts} | 0 ...5-Jump-Game-II.ts => 0045-jump-game-ii.ts} | 0 ...6-Permutations.ts => 0046-permutations.ts} | 0 ...8-Rotate-Image.ts => 0048-rotate-image.ts} | 0 ...oup-Anagrams.ts => 0049-group-anagrams.ts} | 0 typescript/{50-Pow.ts => 0050-powx-n.ts} | 0 typescript/{51-N-Queens => 0051-n-queens.ts} | 0 ...m-Subarray.ts => 0053-maximum-subarray.ts} | 0 ...Spiral-Matrix.ts => 0054-spiral-matrix.ts} | 0 .../{55-Jump-Game.ts => 0055-jump-game.ts} | 0 ...e-Intervals.ts => 0056-merge-intervals.ts} | 0 ...rt-Interval.ts => 0057-insert-interval.ts} | 0 ...st-Word.ts => 0058-length-of-last-word.ts} | 0 ...2-Unique-Paths.ts => 0062-unique-paths.ts} | 0 .../{66-Plus-One.ts => 0066-plus-one.ts} | 0 ...bing-Stairs.ts => 0070-climbing-stairs.ts} | 0 ...Simplify-Path.ts => 0071-simplify-path.ts} | 0 ...ix-Zeroes.ts => 0073-set-matrix-zeroes.ts} | 0 ...D-Matrix.ts => 0074-search-a-2d-matrix.ts} | 0 ...ng.ts => 0076-minimum-window-substring.ts} | 0 typescript/{78-Subsets.ts => 0078-subsets.ts} | 0 ...=> 0084-largest-rectangle-in-histogram.ts} | 0 .../{90-Subsets-II.ts => 0090-subsets-ii.ts} | 0 ...{91-Decode-Ways.ts => 0091-decode-ways.ts} | 0 ... => 0094-binary-tree-inorder-traversal.ts} | 0 ...-String.ts => 0097-interleaving-string.ts} | 0 ...ts => 0098-validate-binary-search-tree.ts} | 0 .../{100-Same-Tree.ts => 0100-same-tree.ts} | 0 ...0102-binary-tree-level-order-traversal.ts} | 0 ...s => 0104-maximum-depth-of-binary-tree.ts} | 0 ...ee-from-preorder-and-inorder-traversal.ts} | 0 ...y-Tree.ts => 0110-balanced-binary-tree.ts} | 0 ...ences.ts => 0115-distinct-subsequences.ts} | 0 ...l-Triangle.ts => 0118-pascals-triangle.ts} | 0 ...> 0121-best-time-to-buy-and-sell-stock.ts} | 0 ...s => 0124-binary-tree-maximum-path-sum.ts} | 0 ...Palindrome.ts => 0125-valid-palindrome.ts} | 0 ...127-Word-Ladder.ts => 0127-word-ladder.ts} | 0 ...s => 0128-longest-consecutive-sequence.ts} | 0 ...-Regions.ts => 0130-surrounded-regions.ts} | 0 ...ing.ts => 0131-palindrome-partitioning.ts} | 0 ...133-Clone-Graph.ts => 0133-clone-graph.ts} | 0 ...134-Gas-Station.ts => 0134-gas-station.ts} | 0 ...Single-Number.ts => 0136-single-number.ts} | 0 ... => 0138-copy-list-with-random-pointer.ts} | 0 .../{139-Word-Break.ts => 0139-word-break.ts} | 0 ...ist-Cycle.ts => 0141-linked-list-cycle.ts} | 0 ...3-Reorder-List.ts => 0143-reorder-list.ts} | 0 ... 0150-evaluate-reverse-polish-notation.ts} | 0 ...ay.ts => 0152-maximum-product-subarray.ts} | 0 ...3-find-minimum-in-rotated-sorted-array.ts} | 0 .../{155-Min-Stack.ts => 0155-min-stack.ts} | 0 ... 0167-two-sum-ii-input-array-is-sorted.ts} | 0 ...ty-Element.ts => 0169-majority-element.ts} | 0 ...rgest-Number.ts => 0179-largest-number.ts} | 0 ...0-Reverse-Bits.ts => 0190-reverse-bits.ts} | 0 ...-of-1-Bits.ts => 0191-number-of-1-bits.ts} | 0 ...8-House-Robber.ts => 0198-house-robber.ts} | 0 ...ts => 0199-binary-tree-right-side-view.ts} | 0 ...f-Islands.ts => 0200-number-of-islands.ts} | 0 ...2-Happy-Number.ts => 0202-happy-number.ts} | 0 ...ts => 0203-remove-linked-list-elements.ts} | 0 ...-Strings.ts => 0205-isomorphic-strings.ts} | 0 ...ed-List.ts => 0206-reverse-linked-list.ts} | 0 ...se-Schedule.ts => 0207-course-schedule.ts} | 0 ....ts => 0208-implement-trie-prefix-tree.ts} | 0 ...edule-II.ts => 0210-course-schedule-ii.ts} | 0 ...gn-add-and-search-words-data-structure.ts} | 0 ...e-Robber-II.ts => 0213-house-robber-ii.ts} | 0 ...> 0215-kth-largest-element-in-an-array.ts} | 0 ...uplicate.ts => 0217-contains-duplicate.ts} | 0 ...ary-Tree.ts => 0226-invert-binary-tree.ts} | 0 ... => 0230-kth-smallest-element-in-a-bst.ts} | 0 ...ommon-ancestor-of-a-binary-search-tree.ts} | 0 ...s => 0238-product-of-array-except-self.ts} | 0 ...Valid-Anagram.ts => 0242-valid-anagram.ts} | 0 ...Valid-Tree.ts => 0261-graph-valid-tree.ts} | 0 ...ssing-Number.ts => 0268-missing-number.ts} | 0 ...r.ts => 0287-find-the-duplicate-number.ts} | 0 ...0-Word-Pattern.ts => 0290-word-pattern.ts} | 0 ...=> 0300-longest-increasing-subsequence.ts} | 0 ...me-to-buy-and-sell-stock-with-cooldown.ts} | 0 ...rst-Balloons.ts => 0312-burst-balloons.ts} | 0 ...322-Coin-Change.ts => 0322-coin-change.ts} | 0 ...Counting-Bits.ts => 0338-counting-bits.ts} | 0 ...verse-String.ts => 0344-reverse-string.ts} | 0 ...nts.ts => 0347-top-k-frequent-elements.ts} | 0 ...ntegers.ts => 0371-sum-of-two-integers.ts} | 0 ....ts => 0380-insert-delete-getrandom-o1.ts} | 0 ...-Subsequence.ts => 0392-is-subsequence.ts} | 0 ...ongest-repeating-character-replacement.ts} | 0 ...s.ts => 0435-non-overlapping-intervals.ts} | 0 .../{494-Target-Sum.ts => 0494-target-sum.ts} | 0 ...nt-I.ts => 0496-next-greater-element-i.ts} | 0 ...in-Change-II.ts => 0518-coin-change-ii.ts} | 0 ...ree.ts => 0543-diameter-of-binary-tree.ts} | 0 .../{554-Brick-Wall.ts => 0554-brick-wall.ts} | 0 ...tring.ts => 0567-permutation-in-string.ts} | 0 ...ree.ts => 0572-subtree-of-another-tree.ts} | 0 ...e-Flowers.ts => 0605-can-place-flowers.ts} | 0 ...sk-Scheduler.ts => 0621-task-scheduler.ts} | 0 ...ings.ts => 0647-palindromic-substrings.ts} | 0 ...e.ts => 0669-trim-a-binary-search-tree.ts} | 0 ...ng.ts => 0678-valid-parenthesis-string.ts} | 0 ...ection.ts => 0684-redundant-connection.ts} | 0 ...f-Island.ts => 0695-max-area-of-island.ts} | 0 ...Binary-Search.ts => 0704-binary-search.ts} | 0 ...eratures.ts => 0739-daily-temperatures.ts} | 0 ...rs.ts => 0746-min-cost-climbing-stairs.ts} | 0 ...> 0787-cheapest-flights-within-k-stops.ts} | 0 ...Straights.ts => 0846-hand-of-straights.ts} | 0 .../{853-Car-Fleet.ts => 0853-car-fleet.ts} | 0 ...Bananas.ts => 0875-koko-eating-bananas.ts} | 0 ...sses.ts => 0929-unique-email-addresses.ts} | 0 ....ts => 0981-time-based-key-value-store.ts} | 0 ...ing-Oranges.ts => 0994-rotting-oranges.ts} | 0 typescript/1046-last-stone-weight.ts | 78 + typescript/1143-longest-common-subsequence.ts | 20 + ...nts-with-greatest-element-on-right-side.ts | 12 + .../1448-count-good-nodes-in-binary-tree.ts | 21 + updateSiteData.js | 151 + verifySiteData.js | 91 + 1624 files changed, 8737 insertions(+), 1708 deletions(-) create mode 100644 .problemSiteData.json rename c/{1-Two-Sum.c => 0001-two-sum.c} (100%) rename c/{2-Add-Two-Numbers.c => 0002-add-two-numbers.c} (100%) rename c/{3-Longest-Substring-Without-Repeating-Characters.c => 0003-longest-substring-without-repeating-characters.c} (100%) rename c/{4-Median-of-Two-Sorted-Arrays.c => 0004-median-of-two-sorted-arrays.c} (100%) rename c/{5-Longest-Palindromic-Substring.c => 0005-longest-palindromic-substring.c} (100%) rename c/{7-Reverse-Integer.c => 0007-reverse-integer.c} (100%) rename c/{11-Container-With-Most-Water.c => 0011-container-with-most-water.c} (100%) rename c/{19-Remove-Nth-Node-From-End-of-List.c => 0019-remove-nth-node-from-end-of-list.c} (100%) rename c/{20-Valid-Parentheses.c => 0020-valid-parentheses.c} (100%) rename c/{21-Merge-Two-Sorted-Lists.c => 0021-merge-two-sorted-lists.c} (100%) rename c/{23-Merge-K-Sorted-Lists.c => 0023-merge-k-sorted-lists.c} (100%) rename c/{25-Reverse-Nodes-in-k-Group.c => 0025-reverse-nodes-in-k-group.c} (100%) rename c/{27-Remove-Element.c => 0027-remove-element.c} (100%) rename c/{33-Search-in-Rotated-Sorted-Array.c => 0033-search-in-rotated-sorted-array.c} (100%) rename c/{35-Search-Insert-Position.c => 0035-search-insert-position.c} (100%) rename c/{36-Valid-Sudoku.c => 0036-valid-sudoku.c} (100%) rename c/{42-Trapping-Rain-Water.c => 0042-trapping-rain-water.c} (100%) rename c/{45-Jump-Game-II.c => 0045-jump-game-ii.c} (100%) rename c/{48-Rotate-Image.c => 0048-rotate-image.c} (100%) rename c/{50-Pow-X-N.c => 0050-powx-n.c} (100%) rename c/{52-N-Queens-II.c => 0052-n-queens-ii.c} (100%) rename c/{53-Maximum-Subarray.c => 0053-maximum-subarray.c} (100%) rename c/{55-Jump-Game.c => 0055-jump-game.c} (100%) rename c/{58-Length-Of-Last-Word.c => 0058-length-of-last-word.c} (100%) rename c/{62-Unique-Paths.c => 0062-unique-paths.c} (100%) rename c/{66-Plus-One.c => 0066-plus-one.c} (100%) rename c/{70-Climbing-Stairs.c => 0070-climbing-stairs.c} (100%) rename c/{73-Set-Matrix-Zeroes.c => 0073-set-matrix-zeroes.c} (100%) rename c/{74-Search-A-2D-Matrix.c => 0074-search-a-2d-matrix.c} (100%) rename c/{75-Sort-Colors.c => 0075-sort-colors.c} (100%) rename c/{76-Minimum-Window-Substring.c => 0076-minimum-window-substring.c} (100%) rename c/{78-Subsets.c => 0078-subsets.c} (100%) rename c/{79-Word-Search.c => 0079-word-search.c} (100%) rename c/{88-Merge-Sorted-Array.c => 0088-merge-sorted-array.c} (100%) rename c/{91-Decode-Ways.c => 0091-decode-ways.c} (100%) rename c/{94-Binary-Tree-Inorder-Traversal.c => 0094-binary-tree-inorder-traversal.c} (100%) rename c/{96-Unique-Binary-Search-Tree.c => 0096-unique-binary-search-trees.c} (100%) rename c/{98-Validate-Binary-Search-Tree.c => 0098-validate-binary-search-tree.c} (100%) rename c/{100-Same-Tree.c => 0100-same-tree.c} (100%) rename c/{102-Binary-Tree-Level-Order-Traversal.c => 0102-binary-tree-level-order-traversal.c} (100%) rename c/{104-Maximum-Depth-Of-Binary-Tree.c => 0104-maximum-depth-of-binary-tree.c} (100%) rename c/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.c => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.c} (100%) rename c/{108-Convert-Sorted-Array.c => 0108-convert-sorted-array-to-binary-search-tree.c} (100%) rename c/{110-Balanced-Binary-Tree.c => 0110-balanced-binary-tree.c} (100%) rename c/{112-Path-Sum.c => 0112-path-sum.c} (100%) rename c/{118-Pascals-Triangle.c => 0118-pascals-triangle.c} (100%) rename c/{121-Best-Time-To-Buy-And-Sell-Stock.c => 0121-best-time-to-buy-and-sell-stock.c} (100%) rename c/{122-Best-Time-to-Buy-and-Sell-Stock-II.c => 0122-best-time-to-buy-and-sell-stock-ii.c} (100%) rename c/{124-Binary-Tree-Maximum-Path-Sum.c => 0124-binary-tree-maximum-path-sum.c} (100%) rename c/{125-Valid-Palindrome.c => 0125-valid-palindrome.c} (100%) rename c/{129-Sum-Root-To-Leaf.c => 0129-sum-root-to-leaf-numbers.c} (100%) rename c/{130-Surrounded-Regions.c => 0130-surrounded-regions.c} (100%) rename c/{133-Clone-Graph.c => 0133-clone-graph.c} (100%) rename c/{134-Gas-Station.c => 0134-gas-station.c} (100%) rename c/{136-Single-Number.c => 0136-single-number.c} (100%) rename c/{138-Copy-List-with-Random-Pointer.c => 0138-copy-list-with-random-pointer.c} (100%) rename c/{141-Linked-List-Cycle.c => 0141-linked-list-cycle.c} (100%) rename c/{143-Reorder-List.c => 0143-reorder-list.c} (100%) rename c/{146-LRU-Cache.c => 0146-lru-cache.c} (100%) rename c/{150-Evaluate-Reverse-Polish-Notation.c => 0150-evaluate-reverse-polish-notation.c} (100%) rename c/{152-Maximum-Product-Subarray.c => 0152-maximum-product-subarray.c} (100%) rename c/{153-Find-Minimum-in-Rotated-Sorted-Array.c => 0153-find-minimum-in-rotated-sorted-array.c} (100%) rename c/{167-Two-Sum-II.c => 0167-two-sum-ii-input-array-is-sorted.c} (100%) rename c/{169-Majority-Element.c => 0169-majority-element.c} (100%) rename c/{190-Reverse-Bits.c => 0190-reverse-bits.c} (100%) rename c/{191-Number-of-1-Bits.c => 0191-number-of-1-bits.c} (100%) rename c/{198-House-Robber.c => 0198-house-robber.c} (100%) rename c/{199-Binary-Tree-Right-Side-View.c => 0199-binary-tree-right-side-view.c} (100%) rename c/{200-Number-Of-Islands.c => 0200-number-of-islands.c} (100%) rename c/{202-Happy-Number.c => 0202-happy-number.c} (100%) rename c/{205-Isomorphic-Strings.c => 0205-isomorphic-strings.c} (100%) rename c/{206-Reverse-Linked-List.c => 0206-reverse-linked-list.c} (100%) rename c/{208-Implement-Trie-Prefix-Tree.c => 0208-implement-trie-prefix-tree.c} (100%) rename c/{209-Minimum-Size-Subarray-Sum.c => 0209-minimum-size-subarray-sum.c} (100%) rename c/{213-House-Robber-II.c => 0213-house-robber-ii.c} (100%) rename c/{217-Contains-Duplicate.c => 0217-contains-duplicate.c} (100%) rename c/{226-Invert-Binary-Tree.c => 0226-invert-binary-tree.c} (100%) rename c/{230-Kth-Smallest-Element-In-BST.c => 0230-kth-smallest-element-in-a-bst.c} (100%) rename c/{235-Lowest-Common-Ancestor-Of-A-Binary-Search-Tree.c => 0235-lowest-common-ancestor-of-a-binary-search-tree.c} (100%) rename c/{238-Product-of-Array-Except-Self.c => 0238-product-of-array-except-self.c} (100%) rename c/{242-Valid-Anagram.c => 0242-valid-anagram.c} (100%) rename c/{263-Ugly-Number.c => 0263-ugly-number.c} (100%) rename c/{268-Missing-Number.c => 0268-missing-number.c} (100%) rename c/{283-Move-Zeroes.c => 0283-move-zeroes.c} (100%) rename c/{287-Find-The-Duplicate-Number.c => 0287-find-the-duplicate-number.c} (100%) rename c/{297-Serialize-and-Deserialize-Binary-Tree.c => 0297-serialize-and-deserialize-binary-tree.c} (100%) rename c/{300-Longest-Increasing-Subsequence.c => 0300-longest-increasing-subsequence.c} (100%) rename c/{309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.c => 0309-best-time-to-buy-and-sell-stock-with-cooldown.c} (100%) rename c/{322-Coin-Change.c => 0322-coin-change.c} (100%) rename c/{329-Longest-Increasing-Path-in-a-Matrix.c => 0329-longest-increasing-path-in-a-matrix.c} (100%) rename c/{338-Counting-Bits.c => 0338-counting-bits.c} (100%) rename c/{344-Reverse-String.c => 0344-reverse-string.c} (100%) rename c/{371-Sum-of-Two-Integers.c => 0371-sum-of-two-integers.c} (100%) rename c/{374-Guess-Number-Higher-Or-Lower.c => 0374-guess-number-higher-or-lower.c} (100%) rename c/{392-Is-Subsequence.c => 0392-is-subsequence.c} (100%) rename c/{417-Pacific-Atlantic-Waterflow.c => 0417-pacific-atlantic-water-flow.c} (100%) rename c/{424-Longest-Repeating-Character-Replacement.c => 0424-longest-repeating-character-replacement.c} (100%) rename c/{463-Island-Perimeter.c => 0463-island-perimeter.c} (100%) rename c/{518-Coin-Change-II.c => 0518-coin-change-ii.c} (100%) rename c/{543-Diameter-Of-Binary-Tree.c => 0543-diameter-of-binary-tree.c} (100%) rename c/{567-Permutation-in-String.c => 0567-permutation-in-string.c} (100%) rename c/{572-Subtree-Of-Another-Tree.c => 0572-subtree-of-another-tree.c} (100%) rename c/{605-Can-Place-Flowers.c => 0605-can-place-flowers.c} (100%) rename c/{617-Merge-Two-Binary-Trees.c => 0617-merge-two-binary-trees.c} (100%) rename c/{647-Palindromic-Substrings.c => 0647-palindromic-substrings.c} (100%) rename c/{678-Valid-Parenthesis-String.c => 0678-valid-parenthesis-string.c} (100%) rename c/{682-Baseball-Game.c => 0682-baseball-game.c} (100%) rename c/{684-Redundant-Connection.c => 0684-redundant-connection.c} (100%) rename c/{695-Max-Area-of-Island.c => 0695-max-area-of-island.c} (100%) rename c/{703-Kth-Largest-Element-In-A-Stream.c => 0703-kth-largest-element-in-a-stream.c} (100%) rename c/{704-Binary-Search.c => 0704-binary-search.c} (100%) rename c/{724-Find-Pivot-Index.c => 0724-find-pivot-index.c} (100%) rename c/{739-Daily-Temperatures.c => 0739-daily-temperatures.c} (100%) rename c/{746-Min-Cost-Climbing-Stairs.c => 0746-min-cost-climbing-stairs.c} (100%) rename c/{875-Koko-Eating-Bananas.c => 0875-koko-eating-bananas.c} (100%) rename c/{881-Boats-To-Save-People.c => 0881-boats-to-save-people.c} (100%) rename c/{953-Verifying-An-Alien-Dictionary.c => 0953-verifying-an-alien-dictionary.c} (100%) rename c/{994-Rotting-Oranges.c => 0994-rotting-oranges.c} (100%) create mode 100644 c/1189-maximum-number-of-balloons.c create mode 100644 c/1288-remove-covered-intervals.c create mode 100644 c/1299-replace-elements-with-greatest-element-on-right-side.c create mode 100644 c/1448-count-good-nodes-in-binary-tree.c create mode 100644 c/1905-count-sub-islands.c rename c/{1968-Array-Not-Average-Neighbors.c => 1968-array-with-elements-not-equal-to-average-of-neighbors.c} (100%) rename cpp/{1-Two-Sum.cpp => 0001-two-sum.cpp} (100%) rename cpp/{2-Add-Two-Numbers.cpp => 0002-add-two-numbers.cpp} (100%) rename cpp/{3-Longest-Substring-Without-Repeating-Characters.cpp => 0003-longest-substring-without-repeating-characters.cpp} (100%) rename cpp/{4-Median-Of-Two-Sorted-Arrays.cpp => 0004-median-of-two-sorted-arrays.cpp} (100%) rename cpp/{5-Longest-Palindrome-Substring.cpp => 0005-longest-palindromic-substring.cpp} (100%) rename cpp/{7-Reverse-Integer.cpp => 0007-reverse-integer.cpp} (100%) rename cpp/{10-Regular-Expression-Matching.cpp => 0010-regular-expression-matching.cpp} (100%) rename cpp/{11-Container-With-Most-Water.cpp => 0011-container-with-most-water.cpp} (100%) rename cpp/{14-4Sum.cpp => 0014-longest-common-prefix.cpp} (100%) rename cpp/{15-3sum.cpp => 0015-3sum.cpp} (100%) rename cpp/{17-Letter-Combinations-Phone-Number.cpp => 0017-letter-combinations-of-a-phone-number.cpp} (100%) rename cpp/{19-Remove-Nth-Node-From-End-Of-List.cpp => 0019-remove-nth-node-from-end-of-list.cpp} (100%) rename cpp/{20-Valid-Parentheses.cpp => 0020-valid-parentheses.cpp} (100%) rename cpp/{21-Merge-Two-Sorted-Lists.cpp => 0021-merge-two-sorted-lists.cpp} (100%) rename cpp/{22-Generate-Parentheses.cpp => 0022-generate-parentheses.cpp} (100%) rename cpp/{23-Merge-K-Sorted-Lists.cpp => 0023-merge-k-sorted-lists.cpp} (100%) rename cpp/{25-Reverse-Nodes-In-K-Group.cpp => 0025-reverse-nodes-in-k-group.cpp} (100%) rename cpp/{33-Search-In-Rotated-Sorted-Array.cpp => 0033-search-in-rotated-sorted-array.cpp} (100%) rename cpp/{35-Search-Insert-Position.cpp => 0035-search-insert-position.cpp} (100%) rename cpp/{36-Valid-Sudoku.cpp => 0036-valid-sudoku.cpp} (100%) rename cpp/{39-Combination-Sum.cpp => 0039-combination-sum.cpp} (100%) rename cpp/{40-Combination-Sum-II.cpp => 0040-combination-sum-ii.cpp} (100%) rename cpp/{42-Trapping-Rain-Water.cpp => 0042-trapping-rain-water.cpp} (100%) rename cpp/{43-Multiply-Strings.cpp => 0043-multiply-strings.cpp} (100%) rename cpp/{45-Jump-Game-II.cpp => 0045-jump-game-ii.cpp} (100%) rename cpp/{46-Permutations.cpp => 0046-permutations.cpp} (100%) rename cpp/{48-Rotate-Image.cpp => 0048-rotate-image.cpp} (100%) rename cpp/{49-Group-Anagrams.cpp => 0049-group-anagrams.cpp} (100%) rename cpp/{50-Pow-X-N.cpp => 0050-powx-n.cpp} (100%) rename cpp/{51-N-Queens.cpp => 0051-n-queens.cpp} (100%) rename cpp/{52-N-Queens-2.cpp => 0052-n-queens-ii.cpp} (100%) rename cpp/{53-Maximum-Subarray.cpp => 0053-maximum-subarray.cpp} (100%) rename cpp/{54-Spiral-Matrix.cpp => 0054-spiral-matrix.cpp} (100%) rename cpp/{55-Jump-Game.cpp => 0055-jump-game.cpp} (100%) rename cpp/{56-Merge-Intervals.cpp => 0056-merge-intervals.cpp} (100%) rename cpp/{57-Insert-Interval.cpp => 0057-insert-interval.cpp} (100%) rename cpp/{58-Length-of-Last-Word.cpp => 0058-length-of-last-word.cpp} (100%) rename cpp/{62-Unique-Paths.cpp => 0062-unique-paths.cpp} (100%) rename cpp/{64-Minimum-Path-Sum.cpp => 0064-minimum-path-sum.cpp} (100%) rename cpp/{66-Plus-One.cpp => 0066-plus-one.cpp} (100%) rename cpp/{70-Climbing-Stairs.cpp => 0070-climbing-stairs.cpp} (100%) rename cpp/{72-Edit-Distance.cpp => 0072-edit-distance.cpp} (100%) rename cpp/{73-Set-Matrix-Zeroes.cpp => 0073-set-matrix-zeroes.cpp} (100%) rename cpp/{74-Search-A-2d-Matrix.cpp => 0074-search-a-2d-matrix.cpp} (100%) rename cpp/{76-Minimum-Window-Substring.cpp => 0076-minimum-window-substring.cpp} (100%) rename cpp/{78-Subsets.cpp => 0078-subsets.cpp} (100%) rename cpp/{79-Word-Search.cpp => 0079-word-search.cpp} (100%) rename cpp/{83-Remove-Duplicates-from-Sorted-List.cpp => 0083-remove-duplicates-from-sorted-list.cpp} (100%) rename cpp/{84-Largest-Rectangle-In-Histogram.cpp => 0084-largest-rectangle-in-histogram.cpp} (100%) rename cpp/{90-Subsets-II.cpp => 0090-subsets-ii.cpp} (100%) rename cpp/{91-Decode-Ways.cpp => 0091-decode-ways.cpp} (100%) rename cpp/{97-Interleaving-String.cpp => 0097-interleaving-string.cpp} (100%) rename cpp/{98-Validate-Binary-Search-Tree.cpp => 0098-validate-binary-search-tree.cpp} (100%) rename cpp/{100-Same-Tree.cpp => 0100-same-tree.cpp} (100%) rename cpp/{102-Binary-Tree-Level-Order-Traversal.cpp => 0102-binary-tree-level-order-traversal.cpp} (100%) rename cpp/{104-Maximum-Depth-Of-Binary-Tree.cpp => 0104-maximum-depth-of-binary-tree.cpp} (100%) rename cpp/{105-Construct-Binary-Tree-From-Preorder-And-Inorder.cpp => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.cpp} (100%) rename cpp/{110-Balanced-Binary-Tree.cpp => 0110-balanced-binary-tree.cpp} (100%) rename cpp/{115-Distinct-Subsequences.cpp => 0115-distinct-subsequences.cpp} (100%) rename cpp/{118-Pascals-Triangle.cpp => 0118-pascals-triangle.cpp} (100%) rename cpp/{120-Triangle.cpp => 0120-triangle.cpp} (100%) rename cpp/{121-Best-Time-To-Buy-And-Sell-Stock.cpp => 0121-best-time-to-buy-and-sell-stock.cpp} (100%) rename cpp/{124-Binary-Tree-Maximum-Path-Sum.cpp => 0124-binary-tree-maximum-path-sum.cpp} (100%) rename cpp/{125-Valid-Palindrome.cpp => 0125-valid-palindrome.cpp} (100%) rename cpp/{127-Word-Ladder.cpp => 0127-word-ladder.cpp} (100%) rename cpp/{128-Longest-Consecutive-Sequence.cpp => 0128-longest-consecutive-sequence.cpp} (100%) rename cpp/{130-Surrounded-Regions.cpp => 0130-surrounded-regions.cpp} (100%) rename cpp/{131-Palindrome-Partitioning.cpp => 0131-palindrome-partitioning.cpp} (100%) rename cpp/{133-Clone-Graph.cpp => 0133-clone-graph.cpp} (100%) rename cpp/{134-Gas-Station.cpp => 0134-gas-station.cpp} (100%) rename cpp/{136-Single-Number.cpp => 0136-single-number.cpp} (100%) rename cpp/{138-Copy-List-With-Random-Pointer.cpp => 0138-copy-list-with-random-pointer.cpp} (100%) rename cpp/{139-Word-Break.cpp => 0139-word-break.cpp} (100%) rename cpp/{141-Linked-List-Cycle.cpp => 0141-linked-list-cycle.cpp} (100%) rename cpp/{143-Reorder-List.cpp => 0143-reorder-list.cpp} (100%) rename cpp/{146-Lru-Cache.cpp => 0146-lru-cache.cpp} (100%) rename cpp/{150-Evaluate-Reverse-Polish-Notation.cpp => 0150-evaluate-reverse-polish-notation.cpp} (100%) rename cpp/{152-Maximum-Product-Subarray.cpp => 0152-maximum-product-subarray.cpp} (100%) rename cpp/{153-Find-Minimum-In-Rotated-Sorted-Array.cpp => 0153-find-minimum-in-rotated-sorted-array.cpp} (100%) rename cpp/{155-Min-Stack.cpp => 0155-min-stack.cpp} (100%) rename cpp/{167-Two-Sum-II.cpp => 0167-two-sum-ii-input-array-is-sorted.cpp} (100%) rename cpp/{169-Majority-Element.cpp => 0169-majority-element.cpp} (100%) rename cpp/{189-Rotate-Array.cpp => 0189-rotate-array.cpp} (100%) rename cpp/{190-Reverse-Bits.cpp => 0190-reverse-bits.cpp} (100%) rename cpp/{191-Number-Of-1-Bits.cpp => 0191-number-of-1-bits.cpp} (100%) rename cpp/{198-House-Robber.cpp => 0198-house-robber.cpp} (100%) rename cpp/{199-Binary-Tree-Right-Side-View.cpp => 0199-binary-tree-right-side-view.cpp} (100%) rename cpp/{200-Number-Of-Islands.cpp => 0200-number-of-islands.cpp} (100%) rename cpp/{202-Happy-Number.cpp => 0202-happy-number.cpp} (100%) rename cpp/{206-Reverse-Linked-List.cpp => 0206-reverse-linked-list.cpp} (100%) rename cpp/{207-Course-Schedule.cpp => 0207-course-schedule.cpp} (100%) rename cpp/{208-Implement-Trie-Prefix-Tree.cpp => 0208-implement-trie-prefix-tree.cpp} (100%) rename cpp/{209-Minimum-Size-Subarray-Sum.cpp => 0209-minimum-size-subarray-sum.cpp} (100%) rename cpp/{210-Course-Schedule-II.cpp => 0210-course-schedule-ii.cpp} (100%) rename cpp/{211-Design-Add-And-Search-Words-Data-Structure.cpp => 0211-design-add-and-search-words-data-structure.cpp} (100%) rename cpp/{212-Word-Search-II.cpp => 0212-word-search-ii.cpp} (100%) rename cpp/{213-House-Robber-II.cpp => 0213-house-robber-ii.cpp} (100%) rename cpp/{215-Kth-Largest-Element-In-Array.cpp => 0215-kth-largest-element-in-an-array.cpp} (100%) rename cpp/{217-Contains-Duplicate.cpp => 0217-contains-duplicate.cpp} (100%) rename cpp/{225-Implement-Stack-Using-Queues.cpp => 0225-implement-stack-using-queues.cpp} (100%) rename cpp/{226-Invert-Binary-Tree.cpp => 0226-invert-binary-tree.cpp} (100%) rename cpp/{230-Kth-Smallest-Element-In-A-Bst.cpp => 0230-kth-smallest-element-in-a-bst.cpp} (100%) rename cpp/{234-Palindrome-Linked-List.cpp => 0234-palindrome-linked-list.cpp} (100%) rename cpp/{235-Lowest-Common-Ancestor-Of-A-Binary-Search-Tree.cpp => 0235-lowest-common-ancestor-of-a-binary-search-tree.cpp} (100%) rename cpp/{238-Product-Of-Array-Except-Self.cpp => 0238-product-of-array-except-self.cpp} (100%) rename cpp/{239-Sliding-Window-Maximum.cpp => 0239-sliding-window-maximum.cpp} (100%) rename cpp/{242-Valid-Anagram-Hashmap.cpp => 0242-valid-anagram.cpp} (100%) rename cpp/{253-Meeting-Rooms-II.cpp => 0253-meeting-rooms.cpp} (100%) rename cpp/{261-Graph-Valid-Tree.cpp => 0261-graph-valid-tree.cpp} (100%) rename cpp/{268-Missing-Number.cpp => 0268-missing-number.cpp} (100%) rename cpp/{269-Alien-Dictionary.cpp => 0269-alien-dictionary.cpp} (100%) rename cpp/{271-Encode-And-Decode-Strings.cpp => 0271-encode-and-decode-strings.cpp} (100%) rename cpp/{283-Move-Zeroes.cpp => 0283-move-zeroes.cpp} (100%) rename cpp/{286-Walls-And-Gates.cpp => 0286-walls-and-gates.cpp} (100%) rename cpp/{287-Find-The-Duplicate-Number.cpp => 0287-find-the-duplicate-number.cpp} (100%) rename cpp/{295-Find-Median-From-Data-Stream.cpp => 0295-find-median-from-data-stream.cpp} (100%) rename cpp/{297-Serialize-And-Deserialize-Binary-Tree.cpp => 0297-serialize-and-deserialize-binary-tree.cpp} (100%) rename cpp/{300-Longest-Increasing-Subsequence.cpp => 0300-longest-increasing-subsequence.cpp} (100%) rename cpp/{309-Best-Time-To-Buy-And-Sell-Stock-With-Cooldown.cpp => 0309-best-time-to-buy-and-sell-stock-with-cooldown.cpp} (100%) rename cpp/{312-Burst-Balloons.cpp => 0312-burst-balloons.cpp} (100%) rename cpp/{322-Coin-Change.cpp => 0322-coin-change.cpp} (100%) rename cpp/{323-Number-Of-Connected-Components-In-An-Undirected-Graph.cpp => 0323-number-of-connected-components-in-an-undirected-graph.cpp} (100%) rename cpp/{329-Longest-Increasing-Path-In-A-Matrix.cpp => 0329-longest-increasing-path-in-a-matrix.cpp} (100%) rename cpp/{332-Reconstruct-Itinerary.cpp => 0332-reconstruct-itinerary.cpp} (100%) rename cpp/{338-Counting-Bits.cpp => 0338-counting-bits.cpp} (100%) rename cpp/{347-Top-K-Frequent-Elements.cpp => 0347-top-k-frequent-elements.cpp} (100%) rename cpp/{355-Design-Twitter.cpp => 0355-design-twitter.cpp} (100%) rename cpp/{371-Sum-Of-Two-Integers.cpp => 0371-sum-of-two-integers.cpp} (100%) rename cpp/{392-Is-Subsequence.cpp => 0392-is-subsequence.cpp} (100%) rename cpp/{402-Remove-K-Digits.cpp => 0402-remove-k-digits.cpp} (100%) rename cpp/{416-Partition-Equal-Subset-Sum.cpp => 0416-partition-equal-subset-sum.cpp} (100%) rename cpp/{417-Pacific-Atlantic-Water-Flow.cpp => 0417-pacific-atlantic-water-flow.cpp} (100%) rename cpp/{424-Longest-Repeating-Character-Replacement.cpp => 0424-longest-repeating-character-replacement.cpp} (100%) rename cpp/{435-Non-Overlapping-Intervals.cpp => 0435-non-overlapping-intervals.cpp} (100%) rename cpp/{438-Find-All-Anagrams-In-A-String.cpp => 0438-find-all-anagrams-in-a-string.cpp} (100%) rename cpp/{448-Find-All-Numbers-Disappeared-In-An-Array.cpp => 0448-find-all-numbers-disappeared-in-an-array.cpp} (100%) rename cpp/{463-Island-Perimeter.cpp => 0463-island-perimeter.cpp} (100%) rename cpp/{473-Matchsticks-to-Square.cpp => 0473-matchsticks-to-square.cpp} (100%) rename cpp/{494-Target-Sum.cpp => 0494-target-sum.cpp} (100%) rename cpp/{518-Coin-Change-2.cpp => 0518-coin-change-ii.cpp} (100%) rename cpp/{543-Diameter-Of-Binary-Tree.cpp => 0543-diameter-of-binary-tree.cpp} (100%) rename cpp/{567-Permutation-In-String.cpp => 0567-permutation-in-string.cpp} (100%) rename cpp/{572-Subtree-Of-Another-Tree.cpp => 0572-subtree-of-another-tree.cpp} (100%) rename cpp/{605-Can-Place-Flowers.cpp => 0605-can-place-flowers.cpp} (100%) rename cpp/{621-Task-Scheduler.cpp => 0621-task-scheduler.cpp} (100%) rename cpp/{647-Palindromic-Substrings.cpp => 0647-palindromic-substrings.cpp} (100%) rename cpp/{678-Valid-Parenthesis-String.cpp => 0678-valid-parenthesis-string.cpp} (100%) rename cpp/{682-Baseball-Game.cpp => 0682-baseball-game.cpp} (100%) rename cpp/{684-Redundant-Connection.cpp => 0684-redundant-connection.cpp} (100%) rename cpp/{695-Max-Area-Of-Island.cpp => 0695-max-area-of-island.cpp} (100%) rename cpp/{703-Kth-Largest-Element-In-A-Stream.cpp => 0703-kth-largest-element-in-a-stream.cpp} (100%) rename cpp/{704-Binary-Search.cpp => 0704-binary-search.cpp} (100%) rename cpp/{724-Find-Pivot-Index.cpp => 0724-find-pivot-index.cpp} (100%) rename cpp/{739-Daily-Temperatures.cpp => 0739-daily-temperatures.cpp} (100%) rename cpp/{743-Network-Delay-Time.cpp => 0743-network-delay-time.cpp} (100%) rename cpp/{746-Min-Cost-Climbing-Stairs.cpp => 0746-min-cost-climbing-stairs.cpp} (100%) rename cpp/{763-Partition-Labels.cpp => 0763-partition-labels.cpp} (100%) rename cpp/{778-Swim-In-Rising-Water.cpp => 0778-swim-in-rising-water.cpp} (100%) rename cpp/{787-Cheapest-Flights-Within-K-Stops.cpp => 0787-cheapest-flights-within-k-stops.cpp} (100%) rename cpp/{846-Hand-Of-Straights.cpp => 0846-hand-of-straights.cpp} (100%) rename cpp/{853-Car-Fleet.cpp => 0853-car-fleet.cpp} (100%) rename cpp/{875-Koko-Eating-Bananas.cpp => 0875-koko-eating-bananas.cpp} (100%) rename cpp/{953-Alien-Dictionary.cpp => 0953-verifying-an-alien-dictionary.cpp} (100%) rename cpp/{973-K-Closest-Points-To-Origin.cpp => 0973-k-closest-points-to-origin.cpp} (100%) rename cpp/{977-Squares-of-a-Sorted-Array.cpp => 0977-squares-of-a-sorted-array.cpp} (100%) rename cpp/{981-Time-Based-Key-Value-Store.cpp => 0981-time-based-key-value-store.cpp} (100%) rename cpp/{994-Rotting-Oranges.cpp => 0994-rotting-oranges.cpp} (100%) create mode 100644 cpp/1046-last-stone-weight.cpp create mode 100644 cpp/1143-longest-common-subsequence.cpp create mode 100644 cpp/1209-remove-all-adjacent-duplicates-in-string-ii.cpp create mode 100644 cpp/1299-replace-elements-with-greatest-element-on-right-side.cpp create mode 100644 cpp/1448-count-good-nodes-in-binary-tree.cpp create mode 100644 cpp/1584-min-cost-to-connect-all-points.cpp create mode 100644 cpp/1851-minimum-interval-to-include-each-query.cpp delete mode 100644 cpp/20-Valid-Parenthesis-String.cpp create mode 100644 cpp/2013-detect-squares.cpp rename csharp/{1-Two-Sum.cs => 0001-two-sum.cs} (100%) rename csharp/{2-Add-Two-Numbers.cs => 0002-add-two-numbers.cs} (100%) rename csharp/{3-Longest-Substring-Without-Repeating-Characters.cs => 0003-longest-substring-without-repeating-characters.cs} (100%) rename csharp/{4-Median-of-Two-Sorted-Arrays.cs => 0004-median-of-two-sorted-arrays.cs} (100%) rename csharp/{5-Longest-Palindromic-Substring.cs => 0005-longest-palindromic-substring.cs} (100%) rename csharp/{7-Reverse-Integer.cs => 0007-reverse-integer.cs} (100%) rename csharp/{10-Regular-Expression-Matching.cs => 0010-regular-expression-matching.cs} (100%) rename csharp/{11-Container-With-Most-Water.cs => 0011-container-with-most-water.cs} (100%) rename csharp/{15-3Sum.cs => 0015-3sum.cs} (100%) rename csharp/{17-Letter-Combinations-Of-A-Phone-Number.cs => 0017-letter-combinations-of-a-phone-number.cs} (100%) rename csharp/{19-Remove-Nth-Node-From-End-of-List.cs => 0019-remove-nth-node-from-end-of-list.cs} (100%) rename csharp/{20-Valid-Parentheses.cs => 0020-valid-parentheses.cs} (100%) rename csharp/{21-Merge-Two-Sorted-Lists.cs => 0021-merge-two-sorted-lists.cs} (100%) rename csharp/{22-Generate-Parentheses.cs => 0022-generate-parentheses.cs} (100%) rename csharp/{23-Merge-K-Sorted-Lists.cs => 0023-merge-k-sorted-lists.cs} (100%) rename csharp/{25-Reverse-Nodes-in-k-Group.cs => 0025-reverse-nodes-in-k-group.cs} (100%) rename csharp/{33-Search-In-Rotated-Sorted-Array.cs => 0033-search-in-rotated-sorted-array.cs} (100%) rename csharp/{34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.cs => 0034-find-first-and-last-position-of-element-in-sorted-array.cs} (100%) rename csharp/{36-Valid-Sudoku.cs => 0036-valid-sudoku.cs} (100%) rename csharp/{39-Combination-Sum.cs => 0039-combination-sum.cs} (100%) rename csharp/{40-Combination-Sum-II.cs => 0040-combination-sum-ii.cs} (100%) rename csharp/{42-Trapping-Rain-Water.cs => 0042-trapping-rain-water.cs} (100%) rename csharp/{43-Multiply-Strings.cs => 0043-multiply-strings.cs} (100%) rename csharp/{45-Jump-Game-II.cs => 0045-jump-game-ii.cs} (100%) rename csharp/{46-Permutations.cs => 0046-permutations.cs} (100%) rename csharp/{48-Rotate-Image.cs => 0048-rotate-image.cs} (100%) rename csharp/{49-Group-Anagrams.cs => 0049-group-anagrams.cs} (100%) rename csharp/{50-Pow(x, n).cs => 0050-powx-n.cs} (100%) rename csharp/{51-N-Queens.cs => 0051-n-queens.cs} (100%) rename csharp/{53-Maximum-Subarray.cs => 0053-maximum-subarray.cs} (100%) rename csharp/{54-Spiral-Matrix.cs => 0054-spiral-matrix.cs} (100%) rename csharp/{55-Jump-Game.cs => 0055-jump-game.cs} (100%) rename csharp/{56-Merge-Intervals.cs => 0056-merge-intervals.cs} (100%) rename csharp/{57-Insert-Interval.cs => 0057-insert-interval.cs} (100%) rename csharp/{58-Length-of-Last-Word.cs => 0058-length-of-last-word.cs} (100%) rename csharp/{62-Unique-Paths.cs => 0062-unique-paths.cs} (100%) rename csharp/{66-Plus-One.cs => 0066-plus-one.cs} (100%) rename csharp/{70-Climbing Stairs.cs => 0070-climbing-stairs.cs} (100%) rename csharp/{72-Edit-Distance.cs => 0072-edit-distance.cs} (100%) rename csharp/{73-Set-Matrix-Zeroes.cs => 0073-set-matrix-zeroes.cs} (100%) rename csharp/{74-Search-A-2D-Matrix.cs => 0074-search-a-2d-matrix.cs} (100%) rename csharp/{76-Minimum-Window-Substring.cs => 0076-minimum-window-substring.cs} (100%) rename csharp/{78-Subsets.cs => 0078-subsets.cs} (100%) rename csharp/{79-Word-Search.cs => 0079-word-search.cs} (100%) rename csharp/{84-Largest-Rectangle-in-Histogram.cs => 0084-largest-rectangle-in-histogram.cs} (100%) rename csharp/{90-Subsets-II.cs => 0090-subsets-ii.cs} (100%) rename csharp/{91-Decode-Ways.cs => 0091-decode-ways.cs} (100%) rename csharp/{97-Interleaving-String.cs => 0097-interleaving-string.cs} (100%) rename csharp/{98-Validate-Binary-Search-Tree.cs => 0098-validate-binary-search-tree.cs} (100%) rename csharp/{100-Same-Tree.cs => 0100-same-tree.cs} (100%) rename csharp/{102-Binary-Tree-Level-Order-Traversal.cs => 0102-binary-tree-level-order-traversal.cs} (100%) rename csharp/{104-Maximum-Depth-of-Binary-Tree.cs => 0104-maximum-depth-of-binary-tree.cs} (100%) rename csharp/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.cs => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.cs} (100%) rename csharp/{110-Balanced-Binary-Tree.cs => 0110-balanced-binary-tree.cs} (100%) rename csharp/{112-Path-Sum.cs => 0112-path-sum.cs} (100%) rename csharp/{115-Distinct-Subsequences.cs => 0115-distinct-subsequences.cs} (100%) rename csharp/{121-Best-Time-To-Buy-and-Sell-Stock.cs => 0121-best-time-to-buy-and-sell-stock.cs} (100%) rename csharp/{124-Binary-Tree-Maximum-Path-Sum.cs => 0124-binary-tree-maximum-path-sum.cs} (100%) rename csharp/{125-Valid-Palindrome.cs => 0125-valid-palindrome.cs} (100%) rename csharp/{127-Word-Ladder.cs => 0127-word-ladder.cs} (100%) rename csharp/{128-Longest-Consecutive-Sequence.cs => 0128-longest-consecutive-sequence.cs} (100%) rename csharp/{130-Surrounded-Regions.cs => 0130-surrounded-regions.cs} (100%) rename csharp/{131-Palindrome-Partitioning.cs => 0131-palindrome-partitioning.cs} (100%) rename csharp/{133-Clone-Graph.cs => 0133-clone-graph.cs} (100%) rename csharp/{134-Gas-Station.cs => 0134-gas-station.cs} (100%) rename csharp/{136-Single-Number.cs => 0136-single-number.cs} (100%) rename csharp/{138-Copy-List-With-Random-Pointer.cs => 0138-copy-list-with-random-pointer.cs} (100%) rename csharp/{139-Word-Break.cs => 0139-word-break.cs} (100%) rename csharp/{141-Linked-List-Cycle.cs => 0141-linked-list-cycle.cs} (100%) rename csharp/{143-Reorder-List.cs => 0143-reorder-list.cs} (100%) rename csharp/{146-LRU-Cache.cs => 0146-lru-cache.cs} (100%) rename csharp/{150-Evaluate-Reverse-Polish-Notation.cs => 0150-evaluate-reverse-polish-notation.cs} (100%) rename csharp/{152-Maximum-Product-Subarray.cs => 0152-maximum-product-subarray.cs} (100%) rename csharp/{153-Find-Minimum-in-Rotated-Sorted-Array.cs => 0153-find-minimum-in-rotated-sorted-array.cs} (100%) rename csharp/{155-Min-Stack.cs => 0155-min-stack.cs} (100%) rename csharp/{167-Two-Sum-II.cs => 0167-two-sum-ii-input-array-is-sorted.cs} (100%) rename csharp/{190-Reverse-Bits.cs => 0190-reverse-bits.cs} (100%) rename csharp/{191-Number-Of-1-Bits.cs => 0191-number-of-1-bits.cs} (100%) rename csharp/{198-House-Robber.cs => 0198-house-robber.cs} (100%) rename csharp/{199-Binary-Tree-Right-Side-View.cs => 0199-binary-tree-right-side-view.cs} (100%) rename csharp/{200-Number-Of-Islands.cs => 0200-number-of-islands.cs} (100%) rename csharp/{202-Happy-Number.cs => 0202-happy-number.cs} (100%) rename csharp/{206-Reverse-Linked-List.cs => 0206-reverse-linked-list.cs} (100%) rename csharp/{207-Course-Schedule.cs => 0207-course-schedule.cs} (100%) rename csharp/{208-Implement-Trie.cs => 0208-implement-trie-prefix-tree.cs} (100%) rename csharp/{210-Course-Schedule-II.cs => 0210-course-schedule-ii.cs} (100%) rename csharp/{211-Design-Add-and-Search-Words-Data-Structure.cs => 0211-design-add-and-search-words-data-structure.cs} (100%) rename csharp/{212-Word-Search-II.cs => 0212-word-search-ii.cs} (100%) rename csharp/{213-House-Robber-II.cs => 0213-house-robber-ii.cs} (100%) rename csharp/{215-Kth-Largest-Element-in-an-Array.cs => 0215-kth-largest-element-in-an-array.cs} (100%) rename csharp/{217-Contains-Duplicate.cs => 0217-contains-duplicate.cs} (100%) rename csharp/{226-Invert-Binary-Tree.cs => 0226-invert-binary-tree.cs} (100%) rename csharp/{230-Kth-Smallest-Element-in-a-BST.cs => 0230-kth-smallest-element-in-a-bst.cs} (100%) rename csharp/{235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.cs => 0235-lowest-common-ancestor-of-a-binary-search-tree.cs} (100%) rename csharp/{238-Product-Of-Array-Except-Self.cs => 0238-product-of-array-except-self.cs} (100%) rename csharp/{239-Sliding-Window-Maximum.cs => 0239-sliding-window-maximum.cs} (100%) rename csharp/{242-Valid-Anagram.cs => 0242-valid-anagram.cs} (100%) rename csharp/{253-Meeting-Rooms-II.cs => 0253-meeting-rooms.cs} (100%) rename csharp/{261-Graph-Valid-Tree.cs => 0261-graph-valid-tree.cs} (100%) rename csharp/{268-Missing-Number.cs => 0268-missing-number.cs} (100%) rename csharp/{269-Alien-Dictionary.cs => 0269-alien-dictionary.cs} (100%) rename csharp/{271-Encode-And-Decode-Strings .cs => 0271-encode-and-decode-strings.cs} (100%) rename csharp/{286-Walls-and-Gates.cs => 0286-walls-and-gates.cs} (100%) rename csharp/{287-Find-the-Duplicate-Number.cs => 0287-find-the-duplicate-number.cs} (100%) rename csharp/{295-Find-Median-From-Data-Stream.cs => 0295-find-median-from-data-stream.cs} (100%) rename csharp/{297-Serialize-and-Deserialize-Binary-Tree.cs => 0297-serialize-and-deserialize-binary-tree.cs} (100%) rename csharp/{300-Longest-Increasing-Subsequence.cs => 0300-longest-increasing-subsequence.cs} (100%) rename csharp/{309-Best-Time-to-Buy-and-Sell-Stock-With-Cooldown.cs => 0309-best-time-to-buy-and-sell-stock-with-cooldown.cs} (100%) rename csharp/{312-Burst-Balloons.cs => 0312-burst-balloons.cs} (100%) rename csharp/{322-Coin-Change.cs => 0322-coin-change.cs} (100%) rename csharp/{323-Number-Of-Connected-Components-In-An-Undirected-Graph.cs => 0323-number-of-connected-components-in-an-undirected-graph.cs} (100%) rename csharp/{329-Longest-Increasing-Path-in-a-Matrix.cs => 0329-longest-increasing-path-in-a-matrix.cs} (100%) rename csharp/{332-Reconstruct-Itinerary.cs => 0332-reconstruct-itinerary.cs} (100%) rename csharp/{338-Counting-Bits.cs => 0338-counting-bits.cs} (100%) rename csharp/{347-Top-K-Frequent-Elements.cs => 0347-top-k-frequent-elements.cs} (100%) rename csharp/{355-Design-Twitter.cs => 0355-design-twitter.cs} (100%) rename csharp/{371-Sum-Of-Two-Integers.cs => 0371-sum-of-two-integers.cs} (100%) rename csharp/{392-Is-Subsequence.cs => 0392-is-subsequence.cs} (100%) rename csharp/{416-Partition-Equal-Subset-Sum.cs => 0416-partition-equal-subset-sum.cs} (100%) rename csharp/{417-Pacific-Atlantic-Water-Flow.cs => 0417-pacific-atlantic-water-flow.cs} (100%) rename csharp/{424-Longest-Repeating-Character-Replacement.cs => 0424-longest-repeating-character-replacement.cs} (100%) rename csharp/{435-Non-overlapping-Intervals.cs => 0435-non-overlapping-intervals.cs} (100%) rename csharp/{438-Find-All-Anagrams-In-A-String.cs => 0438-find-all-anagrams-in-a-string.cs} (100%) rename csharp/{463-Island-Perimeter.cs => 0463-island-perimeter.cs} (100%) rename csharp/{494-Target-Sum.cs => 0494-target-sum.cs} (100%) rename csharp/{518-Coin-Change-II.cs => 0518-coin-change-ii.cs} (100%) rename csharp/{543-Diameter-of-Binary-Tree.cs => 0543-diameter-of-binary-tree.cs} (100%) rename csharp/{567-Permutation-In-String.cs => 0567-permutation-in-string.cs} (100%) rename csharp/{572-Subtree-of-Another-Tree.cs => 0572-subtree-of-another-tree.cs} (100%) rename csharp/{621-Task-Scheduler.cs => 0621-task-scheduler.cs} (100%) rename csharp/{647-Palindromic-Substrings.cs => 0647-palindromic-substrings.cs} (100%) rename csharp/{678-Valid-Parenthesis-String.cs => 0678-valid-parenthesis-string.cs} (100%) rename csharp/{684-Redundant-Connection.cs => 0684-redundant-connection.cs} (100%) rename csharp/{695-Max-Area-of-Island.cs => 0695-max-area-of-island.cs} (100%) rename csharp/{703-Kth-Largest-Element-In-A-Stream.cs => 0703-kth-largest-element-in-a-stream.cs} (100%) rename csharp/{704-Binary-Search.cs => 0704-binary-search.cs} (100%) rename csharp/{739-Daily-Temperatures.cs => 0739-daily-temperatures.cs} (100%) rename csharp/{743-Network-Delay-Time.cs => 0743-network-delay-time.cs} (100%) rename csharp/{746-Min-Cost-Climbing-Stairs.cs => 0746-min-cost-climbing-stairs.cs} (100%) rename csharp/{752-Open-the-Lock.cs => 0752-open-the-lock.cs} (100%) rename csharp/{763-Partition-Labels.cs => 0763-partition-labels.cs} (100%) rename csharp/{778-Swim-in-Rising-Water.cs => 0778-swim-in-rising-water.cs} (100%) rename csharp/{787-Cheapest-Flights-Within-K-Stops.cs => 0787-cheapest-flights-within-k-stops.cs} (100%) rename csharp/{846-Hand-of-Straights.cs => 0846-hand-of-straights.cs} (100%) rename csharp/{853-Car-Fleet.cs => 0853-car-fleet.cs} (100%) rename csharp/{875-Koko-Eating-Bananas.cs => 0875-koko-eating-bananas.cs} (100%) rename csharp/{909-Snakes-and-Ladders.cs => 0909-snakes-and-ladders.cs} (100%) rename csharp/{973-K-Closest-Points-To-Origin.cs => 0973-k-closest-points-to-origin.cs} (100%) rename csharp/{981-Time-Based-Key-Value-Store.cs => 0981-time-based-key-value-store.cs} (100%) rename csharp/{994-Rotting-Oranges.cs => 0994-rotting-oranges.cs} (100%) create mode 100644 csharp/1046-last-stone-weight.cs create mode 100644 csharp/1094-car-pooling.cs create mode 100644 csharp/1143-longest-common-subsequence.cs create mode 100644 csharp/1299-replace-elements-with-greatest-element-on-right-side.cs create mode 100644 csharp/1383-maximum-performance-of-a-team.cs create mode 100644 csharp/1423-maximum-points-you-can-obtain-from-cards.cs create mode 100644 csharp/1448-count-good-nodes-in-binary-tree.cs create mode 100644 csharp/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.cs create mode 100644 csharp/1584-min-cost-to-connect-all-points.cs create mode 100644 csharp/1838-frequency-of-the-most-frequent-element.cs create mode 100644 csharp/1851-minimum-interval-to-include-each-query.cs create mode 100644 csharp/1905-count-sub-islands.cs create mode 100644 csharp/2013-detect-squares.cs rename go/{1-Two-Sum.go => 0001-two-sum.go} (100%) rename go/{3-Longest-Substring-Without-Repeating-Characters.go => 0003-longest-substring-without-repeating-characters.go} (100%) rename go/{4-Median-Of-Two-Sorted-Arrays.go => 0004-median-of-two-sorted-arrays.go} (100%) rename go/{7-Reverse-Integer.go => 0007-reverse-integer.go} (100%) rename go/{11-Container-with-Most-Water.go => 0011-container-with-most-water.go} (100%) rename go/{13-Roman-To-Integer.go => 0013-roman-to-integer.go} (100%) rename go/{15-3Sum.go => 0015-3sum.go} (100%) rename go/{17-Letter-Combinations-of-a-Phone-Number.go => 0017-letter-combinations-of-a-phone-number.go} (100%) rename go/{19-Remove-Nth-Node-From-End-of-List.go => 0019-remove-nth-node-from-end-of-list.go} (100%) rename go/{20-Valid-Parentheses.go => 0020-valid-parentheses.go} (100%) rename go/{21-Merge-Two-Sorted-Lists.go => 0021-merge-two-sorted-lists.go} (100%) rename go/{22-Generate_Parentheses.go => 0022-generate-parentheses.go} (100%) rename go/{24-Swap-Nodes-in-Pairs.go => 0024-swap-nodes-in-pairs.go} (100%) rename go/{26-Remove-Duplicates-From-Sorted-Array.go => 0026-remove-duplicates-from-sorted-array.go} (100%) rename go/{27-Remove-Element.go => 0027-remove-element.go} (100%) rename go/{33-Search-in-Rotated-Sorted-Array.go => 0033-search-in-rotated-sorted-array.go} (100%) rename go/{36-Valid-Sudoku.go => 0036-valid-sudoku.go} (100%) rename go/{39-Combination-Sum.go => 0039-combination-sum.go} (100%) rename go/{40-Combination-Sum-II.go => 0040-combination-sum-ii.go} (100%) rename go/{42-Trapping-Rain-Water.go => 0042-trapping-rain-water.go} (100%) rename go/{45-Jump-Game-II.go => 0045-jump-game-ii.go} (100%) rename go/{46-Permutations.go => 0046-permutations.go} (100%) rename go/{48-Rotate-Image.go => 0048-rotate-image.go} (100%) rename go/{49-Group-Anagrams.go => 0049-group-anagrams.go} (100%) rename go/{51-N-Queens.go => 0051-n-queens.go} (100%) rename go/{53-Maximum-Subarray.go => 0053-maximum-subarray.go} (100%) rename go/{55-Jump-Game.go => 0055-jump-game.go} (100%) rename go/{56-Merge-Intervals.go => 0056-merge-intervals.go} (100%) rename go/{62-Unique-Paths.go => 0062-unique-paths.go} (100%) rename go/{66-Plus-One.go => 0066-plus-one.go} (100%) rename go/{70-Climbing-Stairs.go => 0070-climbing-stairs.go} (100%) rename go/{73-Set-Matrix-Zeroes.go => 0073-set-matrix-zeroes.go} (100%) rename go/{74-Search-A-2D-Matrix.go => 0074-search-a-2d-matrix.go} (100%) rename go/{75-Sort-Colors.go => 0075-sort-colors.go} (100%) rename go/{76-Minimum-Window-Substring.go => 0076-minimum-window-substring.go} (100%) rename go/{78-Subsets.go => 0078-subsets.go} (100%) rename go/{79-Word-Search.go => 0079-word-search.go} (100%) rename go/{83-Remove-Duplicates-from-Sorted-List.go => 0083-remove-duplicates-from-sorted-list.go} (100%) rename go/{84-Largest-Rectangle-In-Histogram.go => 0084-largest-rectangle-in-histogram.go} (100%) rename go/{90-Subsets-II.go => 0090-subsets-ii.go} (100%) rename go/{98-Validate-Binary-Search-Tree.go => 0098-validate-binary-search-tree.go} (100%) rename go/{100-Same-Tree.go => 0100-same-tree.go} (100%) rename go/{102-Binary-Tree-Level-Order-Traversal.go => 0102-binary-tree-level-order-traversal.go} (100%) rename go/{104-Maximum-Depth-of-Binary-Tree.go => 0104-maximum-depth-of-binary-tree.go} (100%) rename go/{110-Balanced-Binary-Tree.go => 0110-balanced-binary-tree.go} (100%) rename go/{121-Best-Time-To-Buy-And-Sell-Stock.go => 0121-best-time-to-buy-and-sell-stock.go} (100%) rename go/{122-Best-Time-to-Buy-and-Sell-Stock-II.go => 0122-best-time-to-buy-and-sell-stock-ii.go} (100%) rename go/{124-Binary-Tree-Maximum-Path-Sum.go => 0124-binary-tree-maximum-path-sum.go} (100%) rename go/{125-Valid-Palindrome.go => 0125-valid-palindrome.go} (100%) rename go/{128-Longest-Consecutive-Sequence.go => 0128-longest-consecutive-sequence.go} (100%) rename go/{130-Surrounded-Regions.go => 0130-surrounded-regions.go} (100%) rename go/{131-Palindrome-Partitioning.go => 0131-palindrome-partitioning.go} (100%) rename go/{133-Clone-Graph.go => 0133-clone-graph.go} (100%) rename go/{134-Gas-Station.go => 0134-gas-station.go} (100%) rename go/{136-Single-Number.go => 0136-single-number.go} (100%) rename go/{141-Linked-List-Cycle.go => 0141-linked-list-cycle.go} (100%) rename go/{143-Reorder-List.go => 0143-reorder-list.go} (100%) rename go/{150-Evaluate-Reverse-Polish-Notation.go => 0150-evaluate-reverse-polish-notation.go} (100%) rename go/{152-Maximum-Product-Subarray.go => 0152-maximum-product-subarray.go} (100%) rename go/{153-Find-Minimum-in-Rotated-Sorted-Array.go => 0153-find-minimum-in-rotated-sorted-array.go} (100%) rename go/{155-Min-Stack.go => 0155-min-stack.go} (100%) rename go/{167-Two-Sum-II.go => 0167-two-sum-ii-input-array-is-sorted.go} (100%) rename go/{190-Reverse-Bits.go => 0190-reverse-bits.go} (100%) rename go/{191-Number-of-1-Bits.go => 0191-number-of-1-bits.go} (100%) rename go/{198-House-Robber.go => 0198-house-robber.go} (100%) rename go/{202-Happy-Number.go => 0202-happy-number.go} (100%) rename go/{203-Remove-Linked-List-Element.go => 0203-remove-linked-list-elements.go} (100%) rename go/{206-Reverse-Linked-List.go => 0206-reverse-linked-list.go} (100%) rename go/{207-Course-Schedule.go => 0207-course-schedule.go} (100%) rename go/{208-Implement-Trie.go => 0208-implement-trie-prefix-tree.go} (100%) rename go/{213-House-Robber-II.go => 0213-house-robber-ii.go} (100%) rename go/{217-Contains-Duplicate.go => 0217-contains-duplicate.go} (100%) rename go/{225-Implement-Stack-using-Queues.go => 0225-implement-stack-using-queues.go} (100%) rename go/{226-Invert-Binary-Tree.go => 0226-invert-binary-tree.go} (100%) rename go/{230-Kth-Smallest-Element-in-a-BST.go => 0230-kth-smallest-element-in-a-bst.go} (100%) rename go/{235-Lowest-Common-Ancestor-Of-BST.go => 0235-lowest-common-ancestor-of-a-binary-search-tree.go} (100%) rename go/{238-Product-Of-Array-Except-Self.go => 0238-product-of-array-except-self.go} (100%) rename go/{239-Sliding-Window-Maximum.go => 0239-sliding-window-maximum.go} (100%) rename go/{242-Valid-Anagram.go => 0242-valid-anagram.go} (100%) rename go/{268-Missing-Number.go => 0268-missing-number.go} (100%) rename go/{271-Encode-And-Decode-Strings.go => 0271-encode-and-decode-strings.go} (100%) rename go/{287-Find-the-Duplicate-Number.go => 0287-find-the-duplicate-number.go} (100%) rename go/{309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.go => 0309-best-time-to-buy-and-sell-stock-with-cooldown.go} (100%) rename go/{323-Number-of-Connected-Components-in-an-Undirected-Graph.go => 0323-number-of-connected-components-in-an-undirected-graph.go} (100%) rename go/{338-Counting-Bits.go => 0338-counting-bits.go} (100%) rename go/{347-Top-K-Frequent-Elements.go => 0347-top-k-frequent-elements.go} (100%) rename go/{371-Sum-of-Two-Integers.go => 0371-sum-of-two-integers.go} (100%) rename go/{392-Is-Subsequence.go => 0392-is-subsequence.go} (100%) rename go/{424-Longest-Repeating-Character-Replacement.go => 0424-longest-repeating-character-replacement.go} (100%) rename go/{435-Non-Overlapping-Intervals.go => 0435-non-overlapping-intervals.go} (100%) rename go/{494-Target-Sum.go => 0494-target-sum.go} (100%) rename go/{543-Diameter-of-Binary-Tree.go => 0543-diameter-of-binary-tree.go} (100%) rename go/{567-Permutation-In-String.go => 0567-permutation-in-string.go} (100%) rename go/{572-Subtree-of-Another-Tree.go => 0572-subtree-of-another-tree.go} (100%) rename go/{684-Redundant-Connection.go => 0684-redundant-connection.go} (100%) rename go/{695-Max-Area-Of-Island.go => 0695-max-area-of-island.go} (100%) rename go/{704-Binary-Search.go => 0704-binary-search.go} (100%) rename go/{739-Daily-Temperatures.go => 0739-daily-temperatures.go} (100%) rename go/{746-Min-Cost-Climbing-Stairs.go => 0746-min-cost-climbing-stairs.go} (100%) rename go/{763-Partition-Labels.go => 0763-partition-labels.go} (100%) rename go/{787-Cheapest-Flights-Within-K-Stops.go => 0787-cheapest-flights-within-k-stops.go} (100%) rename go/{853-Car-Fleet.go => 0853-car-fleet.go} (100%) rename go/{875-Koko-Eating-Bananas.go => 0875-koko-eating-bananas.go} (100%) rename go/{981-Time-Based-Key-Value-Store.go => 0981-time-based-key-value-store.go} (100%) create mode 100644 go/1143-longest-common-subsequence.go create mode 100644 go/1299-replace-elements-with-greatest-element-on-right-side.go rename go/{1448-Count-Good-Nodes-in-BT.go => 1448-count-good-nodes-in-binary-tree.go} (100%) rename java/{1-Two-Sum.java => 0001-two-sum.java} (100%) rename java/{2-Add-Two-Numbers.java => 0002-add-two-numbers.java} (100%) rename java/{3-Longest-Substring-Without-Repeating-Characters.java => 0003-longest-substring-without-repeating-characters.java} (100%) rename java/{4-Median-of-Two-Sorted-Arrays.java => 0004-median-of-two-sorted-arrays.java} (100%) rename java/{5-Longest-Palindromic-Substring.java => 0005-longest-palindromic-substring.java} (100%) rename java/{6-Zigzag-Conversion.java => 0006-zigzag-conversion.java} (100%) rename java/{7-Reverse-Integer.java => 0007-reverse-integer.java} (100%) rename java/{10-Regular-Expression-Matching.java => 0010-regular-expression-matching.java} (100%) rename java/{11-Container-With-Most-Water.java => 0011-container-with-most-water.java} (100%) rename java/{15-3Sum.java => 0015-3sum.java} (100%) rename java/{17-Letter-Combinations-of-a-Phone-Number.java => 0017-letter-combinations-of-a-phone-number.java} (100%) rename java/{19-Remove-Nth-Node-From-End-of-List.java => 0019-remove-nth-node-from-end-of-list.java} (100%) rename java/{20-Valid-Parentheses.java => 0020-valid-parentheses.java} (100%) rename java/{21-Merge-Two-Sorted-Lists.java => 0021-merge-two-sorted-lists.java} (100%) rename java/{22-Generate-Parentheses.java => 0022-generate-parentheses.java} (100%) rename java/{23-Merge-k-Sorted-Lists.java => 0023-merge-k-sorted-lists.java} (100%) rename java/{25-Reverse-Nodes-in-k-Group.java => 0025-reverse-nodes-in-k-group.java} (100%) rename java/{27-Remove-Element.java => 0027-remove-element.java} (100%) rename java/{33-Search-In-Rotated-Sorted-Array.java => 0033-search-in-rotated-sorted-array.java} (100%) rename java/{36-Valid-Sudoku.java => 0036-valid-sudoku.java} (100%) rename java/{39-Combination-Sum.java => 0039-combination-sum.java} (100%) rename java/{40-Combination-Sum-II.java => 0040-combination-sum-ii.java} (100%) rename java/{42-Trapping-Rain-Water.java => 0042-trapping-rain-water.java} (100%) rename java/{43-Multiply-Strings.java => 0043-multiply-strings.java} (100%) rename java/{45-Jump-game-II.java => 0045-jump-game-ii.java} (100%) rename java/{46-Permutations.java => 0046-permutations.java} (100%) rename java/{48-Rotate-Image.java => 0048-rotate-image.java} (100%) rename java/{49-Group-Anagrams.java => 0049-group-anagrams.java} (100%) rename java/{50-Pow(x, n).java => 0050-powx-n.java} (100%) rename java/{51-N-Queens.java => 0051-n-queens.java} (100%) rename java/{53-Maximum-Subarray.java => 0053-maximum-subarray.java} (100%) rename java/{54-Spiral-Matrix.java => 0054-spiral-matrix.java} (100%) rename java/{55-Jump-Game.java => 0055-jump-game.java} (100%) rename java/{56-Merge-Intervals.java => 0056-merge-intervals.java} (100%) rename java/{57-Insert-Interval.java => 0057-insert-interval.java} (100%) rename java/{58-Length-Of-Last-Word.java => 0058-length-of-last-word.java} (100%) rename java/{62-Unique-Paths.java => 0062-unique-paths.java} (100%) rename java/{64-Minimum-Path-Sum.java => 0064-minimum-path-sum.java} (100%) rename java/{66-Plus-One.java => 0066-plus-one.java} (100%) rename java/{70-Climbing-Stairs.java => 0070-climbing-stairs.java} (100%) rename java/{72-Edit-Distance.java => 0072-edit-distance.java} (100%) rename java/{73-Set-Matrix-Zeroes.java => 0073-set-matrix-zeroes.java} (100%) rename java/{74-Search-A-2D-Matrix.java => 0074-search-a-2d-matrix.java} (100%) rename java/{75-Sort-Colors.java => 0075-sort-colors.java} (100%) rename java/{76-Minimum-Window-Substring.java => 0076-minimum-window-substring.java} (100%) rename java/{78-Subsets.java => 0078-subsets.java} (100%) rename java/{79-Word-Search.java => 0079-word-search.java} (100%) rename java/{84-Largest-Rectangle-in-Histogram.java => 0084-largest-rectangle-in-histogram.java} (100%) rename java/{88-Merge-Sorted-Array.java => 0088-merge-sorted-array.java} (100%) rename java/{90-Subsets-II.java => 0090-subsets-ii.java} (100%) rename java/{91-Decode-Ways.java => 0091-decode-ways.java} (100%) rename java/{97-Interleaving-String.java => 0097-interleaving-string.java} (100%) rename java/{98-Validate-Binary-Search-Tree.java => 0098-validate-binary-search-tree.java} (100%) rename java/{100-Same-Tree.java => 0100-same-tree.java} (100%) rename java/{102-Binary-Tree-Level-Order-Traversal.java => 0102-binary-tree-level-order-traversal.java} (100%) rename java/{104-Maximum-Depth-of-Binary-Tree.java => 0104-maximum-depth-of-binary-tree.java} (100%) rename java/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.java => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.java} (100%) rename java/{110-Balanced-Binary-Tree.java => 0110-balanced-binary-tree.java} (100%) rename java/{115-Distinct-Subsequences.java => 0115-distinct-subsequences.java} (100%) rename java/{118-Pascals-Triangle.java => 0118-pascals-triangle.java} (100%) rename java/{120-Triangle.java => 0120-triangle.java} (100%) rename java/{121-Best-Time-to-Buy-and-Sell-Stock.java => 0121-best-time-to-buy-and-sell-stock.java} (100%) rename java/{124-Binary-Tree-Maximum-Path-Sum.java => 0124-binary-tree-maximum-path-sum.java} (100%) rename java/{125-Valid-Palindrome.java => 0125-valid-palindrome.java} (100%) rename java/{127-Word-Ladder.java => 0127-word-ladder.java} (100%) rename java/{128-Longest-Consecutive-Sequence.java => 0128-longest-consecutive-sequence.java} (100%) rename java/{130-Surrounded-Regions.java => 0130-surrounded-regions.java} (100%) rename java/{131-Palindrome-Partitioning.java => 0131-palindrome-partitioning.java} (100%) rename java/{133-Clone-Graph.java => 0133-clone-graph.java} (100%) rename java/{134-Gas-Station.java => 0134-gas-station.java} (100%) rename java/{136-Single-Number.java => 0136-single-number.java} (100%) rename java/{138-Copy-List-with-Random-Pointer.java => 0138-copy-list-with-random-pointer.java} (100%) rename java/{139-Word- Break.java => 0139-word-break.java} (100%) rename java/{143-Reorder-List.java => 0143-reorder-list.java} (100%) rename java/{146-LRU-Cache.java => 0146-lru-cache.java} (100%) rename java/{150-Evaluate-Reverse-Polish-Notation.java => 0150-evaluate-reverse-polish-notation.java} (100%) rename java/{152-Maximum-Product-Subarray.java => 0152-maximum-product-subarray.java} (100%) rename java/{153-Find-Minimum-in-Rotated-Sorted-Array.java => 0153-find-minimum-in-rotated-sorted-array.java} (100%) rename java/{155-Min-Stack.java => 0155-min-stack.java} (100%) rename java/{167-Two-Sum-II.java => 0167-two-sum-ii-input-array-is-sorted.java} (100%) rename java/{173-Binary-Search-Tree-Iterator.java => 0173-binary-search-tree-iterator.java} (100%) rename java/{187-Repeated-DNA-Sequences.java => 0187-repeated-dna-sequences.java} (100%) rename java/{190-Reverse-Bits.java => 0190-reverse-bits.java} (100%) rename java/{191-Number-of-1-Bits.java => 0191-number-of-1-bits.java} (100%) rename java/{198-House-Robber.java => 0198-house-robber.java} (100%) rename java/{199-Binary-Tree-Right-Side-View.java => 0199-binary-tree-right-side-view.java} (100%) rename java/{200-Number-of-Islands.java => 0200-number-of-islands.java} (100%) rename java/{202-Happy-Number.java => 0202-happy-number.java} (100%) rename java/{205-Isomorphic-Strings.java => 0205-isomorphic-strings.java} (100%) rename java/{207-Course-Schedule.java => 0207-course-schedule.java} (100%) rename java/{208-Implement-Trie-Prefix-Tree.java => 0208-implement-trie-prefix-tree.java} (100%) rename java/{210-Course-Schedule-II.java => 0210-course-schedule-ii.java} (100%) rename java/{211-Design-Add-and-Search-Words-Data-Structure.java => 0211-design-add-and-search-words-data-structure.java} (100%) rename java/{212-Word-Search-II.java => 0212-word-search-ii.java} (100%) rename java/{213-House-Robber-II.java => 0213-house-robber-ii.java} (100%) rename java/{215-Kth-Largest-Element-in-an-Array.java => 0215-kth-largest-element-in-an-array.java} (100%) rename java/{217-Contains-Duplicate.java => 0217-contains-duplicate.java} (100%) rename java/{226-Invert-Binary-Tree.java => 0226-invert-binary-tree.java} (100%) rename java/{230-Kth-Smallest-Element-in-a-BST.java => 0230-kth-smallest-element-in-a-bst.java} (100%) rename java/{235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.java => 0235-lowest-common-ancestor-of-a-binary-search-tree.java} (100%) rename java/{238-Product-of-Array-Except-Self.java => 0238-product-of-array-except-self.java} (100%) rename java/{239-Sliding-Window-Maximum.java => 0239-sliding-window-maximum.java} (100%) rename java/{242-Valid-Anagram.java => 0242-valid-anagram.java} (100%) rename java/{253-Meeting-Rooms-ii.java => 0253-meeting-rooms.java} (100%) rename java/{261-Graph-Valid-Tree.java => 0261-graph-valid-tree.java} (100%) rename java/{268-Missing-Number.java => 0268-missing-number.java} (100%) rename java/{269-Alien-Dictionary.java => 0269-alien-dictionary.java} (100%) rename java/{271-Encode-and-Decode-Strings.java => 0271-encode-and-decode-strings.java} (100%) rename java/{279-Perfect-Squares.java => 0279-perfect-squares.java} (100%) rename java/{286-Walls-and-Gates.java => 0286-walls-and-gates.java} (100%) rename java/{287-Find-the-Duplicate-Number.java => 0287-find-the-duplicate-number.java} (100%) rename java/{290-word-pattern => 0290-word-pattern.java} (100%) rename java/{295-Find-Median-from-Data-Stream.java => 0295-find-median-from-data-stream.java} (100%) rename java/{297-Serialize-and-Deserialize-Binary-Tree.java => 0297-serialize-and-deserialize-binary-tree.java} (100%) rename java/{300-Longest-Increasing-Subsequence.java => 0300-longest-increasing-subsequence.java} (100%) rename java/{309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.java => 0309-best-time-to-buy-and-sell-stock-with-cooldown.java} (100%) rename java/{312-Burst-Balloons.java => 0312-burst-balloons.java} (100%) rename java/{322-Coin-Change.java => 0322-coin-change.java} (100%) rename java/{323-Number-of-Connected-Components-in-an-Undirected-Graph.java => 0323-number-of-connected-components-in-an-undirected-graph.java} (100%) rename java/{329-Longest-Increasing-Path-in-a-Matrix.java => 0329-longest-increasing-path-in-a-matrix.java} (100%) rename java/{332-Reconstruct-Itinerary.java => 0332-reconstruct-itinerary.java} (100%) rename java/{338-Counting-Bits.java => 0338-counting-bits.java} (100%) rename java/{347-Top-K-Frequent-Elements.java => 0347-top-k-frequent-elements.java} (100%) rename java/{355-Design-Twitter.java => 0355-design-twitter.java} (100%) rename java/{371-Sum-of-Two-Integers.java => 0371-sum-of-two-integers.java} (100%) rename java/{380-Insert-Delete-GetRandom-O(1).java => 0380-insert-delete-getrandom-o1.java} (100%) rename java/{392-Is-Subsequence.java => 0392-is-subsequence.java} (100%) rename java/{416-Partition-Equal-Subset-Sum.java => 0416-partition-equal-subset-sum.java} (100%) rename java/{417-Pacific-Atlantic-Water-Flow.java => 0417-pacific-atlantic-water-flow.java} (100%) rename java/{424-Longest-Repeating-Character-Replacement.java => 0424-longest-repeating-character-replacement.java} (100%) rename java/{435-Non-Overlapping-Intervals.java => 0435-non-overlapping-intervals.java} (100%) rename java/{448-Find-All-Numbers-Disappeared-in-an-Array.java => 0448-find-all-numbers-disappeared-in-an-array.java} (100%) rename java/{494-Target-Sum.java => 0494-target-sum.java} (100%) rename java/{496-Next-Greater-Element-I.java => 0496-next-greater-element-i.java} (100%) rename java/{513-Find-Bottom-Left-Tree-Value.java => 0513-find-bottom-left-tree-value.java} (100%) rename java/{518-Coin-Change-2.java => 0518-coin-change-ii.java} (100%) rename java/{523-Continuous-Subarray-Sum.java => 0523-continuous-subarray-sum.java} (100%) rename java/{543-Diameter-of-Binary-Tree.java => 0543-diameter-of-binary-tree.java} (100%) rename java/{560-Subarray-Sum-Equals-K.java => 0560-subarray-sum-equals-k.java} (100%) rename java/{567-Permutation-in-String.java => 0567-permutation-in-string.java} (100%) rename java/{572-Subtree-of-Another-Tree.java => 0572-subtree-of-another-tree.java} (100%) rename java/{617-Merge-Two-Binary-Trees.java => 0617-merge-two-binary-trees.java} (100%) rename java/{621-Task-Scheduler.java => 0621-task-scheduler.java} (100%) rename java/{647-Palindromic-Substrings.java => 0647-palindromic-substrings.java} (100%) rename java/{678-Valid-Parenthesis-String.java => 0678-valid-parenthesis-string.java} (100%) rename java/{684-Redundant-Connection.java => 0684-redundant-connection.java} (100%) rename java/{695-Max-Area-of-Island.java => 0695-max-area-of-island.java} (100%) rename java/{703-Kth-Largest-Element-in-a-Stream.java => 0703-kth-largest-element-in-a-stream.java} (100%) rename java/{704-Binary-Search.java => 0704-binary-search.java} (100%) rename java/{724-Find-Pivot-Index => 0724-find-pivot-index.java} (100%) rename java/{739-Daily-Temperatures.java => 0739-daily-temperatures.java} (100%) rename java/{743-Network-Delay-Time.java => 0743-network-delay-time.java} (100%) rename java/{746-Min-Cost-Climbing-Stairs.java => 0746-min-cost-climbing-stairs.java} (100%) rename java/{752-Open-the-lock.java => 0752-open-the-lock.java} (100%) rename java/{763-Partition-Labels.java => 0763-partition-labels.java} (100%) rename java/{767-Reorganize-String.java => 0767-reorganize-string.java} (100%) rename java/{778-Swim-in-Rising-Water.java => 0778-swim-in-rising-water.java} (100%) rename java/{787-Cheapest-Flights-Within-K-Stops.java => 0787-cheapest-flights-within-k-stops.java} (100%) rename java/{846-Hand-of-Straights.java => 0846-hand-of-straights.java} (100%) rename java/{853-Car Fleet.java => 0853-car-fleet.java} (100%) rename java/{875-Koko-Eating-Bananas.java => 0875-koko-eating-bananas.java} (100%) rename java/{929-Unique-Email-Addresses.java => 0929-unique-email-addresses.java} (100%) rename java/{973-K-Closest-Points-to-Origin.java => 0973-k-closest-points-to-origin.java} (100%) rename java/{981-Time-Based-Key-Value-Store.java => 0981-time-based-key-value-store.java} (100%) rename java/{994-Rotting-Oranges.java => 0994-rotting-oranges.java} (100%) create mode 100644 java/1046-last-stone-weight.java create mode 100644 java/1143-longest-common-subsequence.java rename java/{1189-Maximum-Number-of-Balloons => 1189-maximum-number-of-balloons.java} (100%) create mode 100644 java/1299-replace-elements-with-greatest-element-on-right-side.java create mode 100644 java/1448-count-good-nodes-in-binary-tree.java create mode 100644 java/1584-min-cost-to-connect-all-points.java create mode 100644 java/1851-minimum-interval-to-include-each-query.java create mode 100644 java/1985-find-the-kth-largest-integer-in-the-array.java create mode 100644 java/2013-detect-squares.java rename javascript/{1-Two-Sum.js => 0001-two-sum.js} (100%) rename javascript/{2-Add-Two-Numbers.js => 0002-add-two-numbers.js} (100%) rename javascript/{3-Longest-Substring-Without-Repeating-Characters.js => 0003-longest-substring-without-repeating-characters.js} (100%) rename javascript/{4-Median-Of-Two-Sorted-Arrays.js => 0004-median-of-two-sorted-arrays.js} (100%) rename javascript/{5-Longest-Palindromic-Substring.js => 0005-longest-palindromic-substring.js} (100%) rename javascript/{7-Reverse-Integer.js => 0007-reverse-integer.js} (100%) rename javascript/{9-Palindrome-Number.js => 0009-palindrome-number.js} (100%) rename javascript/{10-Regular-Expression-Matching.js => 0010-regular-expression-matching.js} (100%) rename javascript/{11-Container-With-Most-Water.js => 0011-container-with-most-water.js} (100%) rename javascript/{13-Roman-to-Integer.js => 0013-roman-to-integer.js} (100%) rename javascript/{14-Longest-Common-Prefix.js => 0014-longest-common-prefix.js} (100%) rename javascript/{15-3Sum.js => 0015-3sum.js} (100%) rename javascript/{17-Letter-Combinations-of-a-Phone-Number.js => 0017-letter-combinations-of-a-phone-number.js} (100%) rename javascript/{19-Remove-Nth-Node-From-End-of-List.js => 0019-remove-nth-node-from-end-of-list.js} (100%) rename javascript/{20-Valid-Parentheses.js => 0020-valid-parentheses.js} (100%) rename javascript/{21-Merge-Two-Sorted-Lists.js => 0021-merge-two-sorted-lists.js} (100%) rename javascript/{22-Generate-Parentheses.js => 0022-generate-parentheses.js} (100%) rename javascript/{23-Merge-K-Sorted-Lists.js => 0023-merge-k-sorted-lists.js} (100%) rename javascript/{25-Reverse-Nodes-in-K-Group.js => 0025-reverse-nodes-in-k-group.js} (100%) rename javascript/{26-Remove-Duplicates-from-Sorted-Array.js => 0026-remove-duplicates-from-sorted-array.js} (100%) rename javascript/{27-Remove-Element.js => 0027-remove-element.js} (100%) rename javascript/{33-Search-in-Rotated-Sorted-Array.js => 0033-search-in-rotated-sorted-array.js} (100%) rename javascript/{35-Search-Insert-Position.js => 0035-search-insert-position.js} (100%) rename javascript/{36-Valid-Sudoku.js => 0036-valid-sudoku.js} (100%) rename javascript/{39-Combination-Sum.js => 0039-combination-sum.js} (100%) rename javascript/{40-Combination-Sum-II.js => 0040-combination-sum-ii.js} (100%) rename javascript/{42-Trapping-Rain-Water.js => 0042-trapping-rain-water.js} (100%) rename javascript/{43-Multiply-Strings.js => 0043-multiply-strings.js} (100%) rename javascript/{45-Jump-Game-II.js => 0045-jump-game-ii.js} (100%) rename javascript/{46-Permutations.js => 0046-permutations.js} (100%) rename javascript/{48-Rotate-Image.js => 0048-rotate-image.js} (100%) rename javascript/{49-Group-Anagrams.js => 0049-group-anagrams.js} (100%) rename javascript/{51-solveNQueens.js => 0051-n-queens.js} (100%) rename javascript/{52-totalNQueens.js => 0052-n-queens-ii.js} (100%) rename javascript/{53-Maximum-Subarray.js => 0053-maximum-subarray.js} (100%) rename javascript/{54-Spiral-Matrix.js => 0054-spiral-matrix.js} (100%) rename javascript/{55-Jump-Game.js => 0055-jump-game.js} (100%) rename javascript/{56-Merge-Intervals.js => 0056-merge-intervals.js} (100%) rename javascript/{57-Insert-Interval.js => 0057-insert-interval.js} (100%) rename javascript/{58-Length-Of-Last-Word.js => 0058-length-of-last-word.js} (100%) rename javascript/{62-Unique-Paths.js => 0062-unique-paths.js} (100%) rename javascript/{66-plus-one.js => 0066-plus-one.js} (100%) rename javascript/{70-Climbing-Stairs.js => 0070-climbing-stairs.js} (100%) rename javascript/{72-Edit-Distance.js => 0072-edit-distance.js} (100%) rename javascript/{73-Set-Matrix-Zeroes.js => 0073-set-matrix-zeroes.js} (100%) rename javascript/{74-Search-A-2D-Matrix.js => 0074-search-a-2d-matrix.js} (100%) rename javascript/{75-sort-colors.js => 0075-sort-colors.js} (100%) rename javascript/{76-Minimum-Window-Substring.js => 0076-minimum-window-substring.js} (100%) rename javascript/{78-Subsets.js => 0078-subsets.js} (100%) rename javascript/{79-Word-Search.js => 0079-word-search.js} (100%) rename javascript/{83-Remove-Duplicates-From-Sorted-List.js => 0083-remove-duplicates-from-sorted-list.js} (100%) rename javascript/{84-Largest-Rectangle-in-Histogram.js => 0084-largest-rectangle-in-histogram.js} (100%) rename javascript/{88-Merge-Sorted-Array.js => 0088-merge-sorted-array.js} (100%) rename javascript/{90-Subsets-II.js => 0090-subsets-ii.js} (100%) rename javascript/{91-Decode-Ways.js => 0091-decode-ways.js} (100%) rename javascript/{92-Reverse-Linked-List-II.js => 0092-reverse-linked-list-ii.js} (100%) rename javascript/{94-Binary-Tree-Inorder-Traversal.js => 0094-binary-tree-inorder-traversal.js} (100%) rename javascript/{97-Interleaving-String.js => 0097-interleaving-string.js} (100%) rename javascript/{98-Validate-Binary-Search-Tree.js => 0098-validate-binary-search-tree.js} (100%) rename javascript/{100-Same-Tree.js => 0100-same-tree.js} (100%) rename javascript/{102-Binary-Tree-Level-Order-Traversal.js => 0102-binary-tree-level-order-traversal.js} (100%) rename javascript/{104-Maximum-Depth-of-Binary-Tree.js => 0104-maximum-depth-of-binary-tree.js} (100%) rename javascript/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.js => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.js} (100%) rename javascript/{108-Convert-Sorted-Array-to-Binary-Search-Tree.js => 0108-convert-sorted-array-to-binary-search-tree.js} (100%) rename javascript/{110-Balanced-Binary-Tree.js => 0110-balanced-binary-tree.js} (100%) rename javascript/{112-Path-Sum.js => 0112-path-sum.js} (100%) rename javascript/{115-Distinct-Subsequences.js => 0115-distinct-subsequences.js} (100%) rename javascript/{118-Pascals-Triangle.js => 0118-pascals-triangle.js} (100%) rename javascript/{121-Best-Time-to-Buy-and-Sell-Stock.js => 0121-best-time-to-buy-and-sell-stock.js} (100%) rename javascript/{122-best-time-to-buy-and-sell-stock-ii.js => 0122-best-time-to-buy-and-sell-stock-ii.js} (100%) rename javascript/{124-Binary-Tree-Maximum-Path-Sum.js => 0124-binary-tree-maximum-path-sum.js} (100%) rename javascript/{125-Valid-Palindrome.js => 0125-valid-palindrome.js} (100%) rename javascript/{127-Word-Ladder.js => 0127-word-ladder.js} (100%) rename javascript/{128-Longest-consecutive-sequence.js => 0128-longest-consecutive-sequence.js} (100%) rename javascript/{130-Surrounded-Regions.js => 0130-surrounded-regions.js} (100%) rename javascript/{131-Palindrome-Partitioning.js => 0131-palindrome-partitioning.js} (100%) rename javascript/{133-Clone-Graph.js => 0133-clone-graph.js} (100%) rename javascript/{134-Gas-Station.js => 0134-gas-station.js} (100%) rename javascript/{136-Single-Number.js => 0136-single-number.js} (100%) rename javascript/{138-Copy-List-with-Random-Pointer.js => 0138-copy-list-with-random-pointer.js} (100%) rename javascript/{139-Word-Break.js => 0139-word-break.js} (100%) rename javascript/{141-Linked-List-Cycle.js => 0141-linked-list-cycle.js} (100%) rename javascript/{143-Reorder-List.js => 0143-reorder-list.js} (100%) rename javascript/{146-LRU-Cache.js => 0146-lru-cache.js} (100%) rename javascript/{150-Evaluate-Reverse-Polish-Notation.js => 0150-evaluate-reverse-polish-notation.js} (100%) rename javascript/{152-Maximum-Product-Subarray.js => 0152-maximum-product-subarray.js} (100%) rename javascript/{153-Find-Minimum-in-Rotated-Sorted-Array.js => 0153-find-minimum-in-rotated-sorted-array.js} (100%) rename javascript/{155-Min-Stack.js => 0155-min-stack.js} (100%) rename javascript/{160-Intersection-of-Two-Linked-Lists.js => 0160-intersection-of-two-linked-lists.js} (100%) rename javascript/{167-Two-Sum-II.js => 0167-two-sum-ii-input-array-is-sorted.js} (100%) rename javascript/{169-majority-element.js => 0169-majority-element.js} (100%) rename javascript/{173-Binary-Search-Tree-Iterator.js => 0173-binary-search-tree-iterator.js} (100%) rename javascript/{190-Reverse-Bits.js => 0190-reverse-bits.js} (100%) rename javascript/{191-Number-of-1-bits.js => 0191-number-of-1-bits.js} (100%) rename javascript/{198-House-Robber.js => 0198-house-robber.js} (100%) rename javascript/{199-binary-tree-right-side-view.js => 0199-binary-tree-right-side-view.js} (100%) rename javascript/{200-Number-of-Islands.js => 0200-number-of-islands.js} (100%) rename javascript/{202-Happy-Number.js => 0202-happy-number.js} (100%) rename javascript/{203-Remove-Linked-List-Elements.js => 0203-remove-linked-list-elements.js} (100%) rename javascript/{205-Isomorphic-Strings.js => 0205-isomorphic-strings.js} (100%) rename javascript/{206-Reverse-Linked-List.js => 0206-reverse-linked-list.js} (100%) rename javascript/{207-Course-Schedule.js => 0207-course-schedule.js} (100%) rename javascript/{208-Implement-Trie.js => 0208-implement-trie-prefix-tree.js} (100%) rename javascript/{210-Course-Schedule-II.js => 0210-course-schedule-ii.js} (100%) rename javascript/{211-Design-Add-and-Search-Words-Data-Structure.js => 0211-design-add-and-search-words-data-structure.js} (100%) rename javascript/{212-Word-Search-ii.js => 0212-word-search-ii.js} (100%) rename javascript/{213-House-Robber-II.js => 0213-house-robber-ii.js} (100%) rename javascript/{215-Kth-Largest-Element-in-an-Array.js => 0215-kth-largest-element-in-an-array.js} (100%) rename javascript/{217-Contains-Duplicate.js => 0217-contains-duplicate.js} (100%) rename javascript/{226-Invert-Binary-Tree.js => 0226-invert-binary-tree.js} (100%) rename javascript/{230-Kth-Smallest-Element-in-a-BST.js => 0230-kth-smallest-element-in-a-bst.js} (100%) rename javascript/{234-Palindrome-Linked-List.js => 0234-palindrome-linked-list.js} (100%) rename javascript/{235-lowest-common-ancestor-of-a-binary-search-tree.js => 0235-lowest-common-ancestor-of-a-binary-search-tree.js} (100%) rename javascript/{238-Product-of-Array-Except-Self.js => 0238-product-of-array-except-self.js} (100%) rename javascript/{239-Sliding-Window-Maximum.js => 0239-sliding-window-maximum.js} (100%) rename javascript/{242-Valid-Anagram.js => 0242-valid-anagram.js} (100%) rename javascript/{253-Meeting-Rooms-ii.js => 0253-meeting-rooms.js} (100%) rename javascript/{261-Graph-Valid-Tree.js => 0261-graph-valid-tree.js} (100%) rename javascript/{268-Missing-Number.js => 0268-missing-number.js} (100%) rename javascript/{269-Alien-Dictionary.js => 0269-alien-dictionary.js} (100%) rename javascript/{271-Encode-and-Decode-Strings.js => 0271-encode-and-decode-strings.js} (100%) rename javascript/{283-Move-Zeroes.js => 0283-move-zeroes.js} (100%) rename javascript/{286-Walls-And-Gates.js => 0286-walls-and-gates.js} (100%) rename javascript/{287-Find-the-Duplicate-Number.js => 0287-find-the-duplicate-number.js} (100%) rename javascript/{290-word-pattern.js => 0290-word-pattern.js} (100%) rename javascript/{295-Find-Median-from-Data-Stream.js => 0295-find-median-from-data-stream.js} (100%) rename javascript/{297-Serialize-And-Deserialize-Binary-Tree.js => 0297-serialize-and-deserialize-binary-tree.js} (100%) rename javascript/{300-Longest-Increasing-Subsequence.js => 0300-longest-increasing-subsequence.js} (100%) rename javascript/{309-Best-Time-To-Buy-And-Sell-Stock-With-Cooldown.js => 0309-best-time-to-buy-and-sell-stock-with-cooldown.js} (100%) rename javascript/{312-Burst-Balloons.js => 0312-burst-balloons.js} (100%) rename javascript/{322-Coin-Change.js => 0322-coin-change.js} (100%) rename javascript/{323-countComponents.js => 0323-number-of-connected-components-in-an-undirected-graph.js} (100%) rename javascript/{329-Longest-Increasing-Path-in-a-Matrix.js => 0329-longest-increasing-path-in-a-matrix.js} (100%) rename javascript/{332-Reconstruct-Itinerary.js => 0332-reconstruct-itinerary.js} (100%) rename javascript/{338-Counting-Bits.js => 0338-counting-bits.js} (100%) rename javascript/{344-Reverse-String.js => 0344-reverse-string.js} (100%) rename javascript/{347-Top-K-Frequent-Elements.js => 0347-top-k-frequent-elements.js} (100%) rename javascript/{355-Design-Twitter.js => 0355-design-twitter.js} (100%) rename javascript/{367-Valid-Perfect-Square.js => 0367-valid-perfect-square.js} (100%) rename javascript/{371-Sum-of-Two-Integers.js => 0371-sum-of-two-integers.js} (100%) rename javascript/{392-Is-Subsequence.js => 0392-is-subsequence.js} (100%) rename javascript/{416-Partition-Equal-Subset-Sum.js => 0416-partition-equal-subset-sum.js} (100%) rename javascript/{417-Pacific-Atlantic-Water-Flow.js => 0417-pacific-atlantic-water-flow.js} (100%) rename javascript/{424-Longest-Repeating-Character-Replacement.js => 0424-longest-repeating-character-replacement.js} (100%) rename javascript/{435-Non-overlapping-Intervals.js => 0435-non-overlapping-intervals.js} (100%) rename javascript/{448-find-all-numbers-disappeared-in-an-array.js => 0448-find-all-numbers-disappeared-in-an-array.js} (100%) rename javascript/{473-Matchsticks-To-Square.js => 0473-matchsticks-to-square.js} (100%) rename javascript/{494-Target-Sum.js => 0494-target-sum.js} (100%) rename javascript/{518-Coin-Change-2.js => 0518-coin-change-ii.js} (100%) rename javascript/{535-encode-and-decode-tinyurl.js => 0535-encode-and-decode-tinyurl.js} (100%) rename javascript/{543-Diameter-Of-Binary-Tree.js => 0543-diameter-of-binary-tree.js} (100%) rename javascript/{554-brick-wall.js => 0554-brick-wall.js} (100%) rename javascript/{567-Permutation-In-String.js => 0567-permutation-in-string.js} (100%) rename javascript/{572-Subtree-of-Another-Tree.js => 0572-subtree-of-another-tree.js} (100%) rename javascript/{605-can-place-flowers.js => 0605-can-place-flowers.js} (100%) rename javascript/{617-Merge-Two-Binary-Trees.js => 0617-merge-two-binary-trees.js} (100%) rename javascript/{621-Task-Scheduler.js => 0621-task-scheduler.js} (100%) rename javascript/{647-Palindromic-Substrings.js => 0647-palindromic-substrings.js} (100%) rename javascript/{669-Trim-a-Binary-Search-Tree.js => 0669-trim-a-binary-search-tree.js} (100%) rename javascript/{678-Valid-Parenthesis-String.js => 0678-valid-parenthesis-string.js} (100%) rename javascript/{684-Redundant-Connection.js => 0684-redundant-connection.js} (100%) rename javascript/{695-Max-Area-Of-Island.js => 0695-max-area-of-island.js} (100%) rename javascript/{703-Kth-Largest-Element-In-A-Stream.js => 0703-kth-largest-element-in-a-stream.js} (100%) rename javascript/{704-Binary-Search.js => 0704-binary-search.js} (100%) rename javascript/{724-Find-Pivot-Index.js => 0724-find-pivot-index.js} (100%) rename javascript/{739-daily-temperatures.js => 0739-daily-temperatures.js} (100%) rename javascript/{743-Network-Delay-Time.js => 0743-network-delay-time.js} (100%) rename javascript/{746-Min-Cost-Climbing-Stairs.js => 0746-min-cost-climbing-stairs.js} (100%) rename javascript/{763-Partition-Labels.js => 0763-partition-labels.js} (100%) rename javascript/{778-Swim-in-Rising-Water.js => 0778-swim-in-rising-water.js} (100%) rename javascript/{787-Cheapest-Flights-Within-K-Stops.js => 0787-cheapest-flights-within-k-stops.js} (100%) rename javascript/{846-Hand-of-Straights.js => 0846-hand-of-straights.js} (100%) rename javascript/{853-Car-Fleet.js => 0853-car-fleet.js} (100%) rename javascript/{875-Koko-Eating-Bananas.js => 0875-koko-eating-bananas.js} (100%) rename javascript/{929-Unique-Email-Addresses.js => 0929-unique-email-addresses.js} (100%) rename javascript/{973-K-Closest-Points-to-Origin.js => 0973-k-closest-points-to-origin.js} (100%) rename javascript/{981-Time-Based-Key-Value-Store.js => 0981-time-based-key-value-store.js} (100%) rename javascript/{994-Rotting-Oranges.js => 0994-rotting-oranges.js} (100%) create mode 100644 javascript/1046-last-stone-weight.js create mode 100644 javascript/1143-longest-common-subsequence.js create mode 100644 javascript/1209-remove-all-adjacent-duplicates-in-string-ii.js create mode 100644 javascript/1299-replace-elements-with-greatest-element-on-right-side.js create mode 100644 javascript/1448-count-good-nodes-in-binary-tree.js create mode 100644 javascript/1584-min-cost-to-connect-all-points.js create mode 100644 javascript/1984-minimum-difference-between-highest-and-lowest-of-k-scores.js rename javascript/{2001-Number-of-Pairs -of-Interchangeable-Rectangles.js => 2001-number-of-pairs-of-interchangeable-rectangles.js} (100%) create mode 100644 javascript/2013-detect-squares.js delete mode 100644 javascript/297-Serialize-and-Deserialize-Binary-Tree.js rename kotlin/{1-Two-Sum.kt => 0001-two-sum.kt} (100%) rename kotlin/{2-Add-Two-Numbers.kt => 0002-add-two-numbers.kt} (100%) rename kotlin/{3-Longest-Substring-Without-Repeating-Characters.kt => 0003-longest-substring-without-repeating-characters.kt} (100%) rename kotlin/{4-Median-Of-Two-Sorted-Arrays.kt => 0004-median-of-two-sorted-arrays.kt} (100%) rename kotlin/{7-Reverse-Integer.kt => 0007-reverse-integer.kt} (100%) rename kotlin/{11-Container-With-Most-Water.kt => 0011-container-with-most-water.kt} (100%) rename kotlin/{15-3Sum.kt => 0015-3sum.kt} (100%) rename kotlin/{19-Remove-Nth-Node-From-End-of-List.kt => 0019-remove-nth-node-from-end-of-list.kt} (100%) rename kotlin/{20-Valid-Parentheses.kt => 0020-valid-parentheses.kt} (100%) rename kotlin/{21-Merge-Two-Sorted-Lists.kt => 0021-merge-two-sorted-lists.kt} (100%) rename kotlin/{22-Generate-Parentheses.kt => 0022-generate-parentheses.kt} (100%) rename kotlin/{23-Merge-K-Sorted-Lists.kt => 0023-merge-k-sorted-lists.kt} (100%) rename kotlin/{25-Reverse-Nodes-In-K-Group.kt => 0025-reverse-nodes-in-k-group.kt} (100%) rename kotlin/{33-Search-In-Rotated-Sorted-Array.kt => 0033-search-in-rotated-sorted-array.kt} (100%) rename kotlin/{36-Valid-Sudoku.kt => 0036-valid-sudoku.kt} (100%) rename kotlin/{39-Combination-Sum.kt => 0039-combination-sum.kt} (100%) rename kotlin/{40-Combination-Sum.kt => 0040-combination-sum-ii.kt} (100%) rename kotlin/{42-Trapping-Rain-Water.kt => 0042-trapping-rain-water.kt} (100%) rename kotlin/{45-Jump-Game-II.kt => 0045-jump-game-ii.kt} (100%) rename kotlin/{46-Permutations.kt => 0046-permutations.kt} (100%) rename kotlin/{49-Group-Anagrams.kt => 0049-group-anagrams.kt} (100%) rename kotlin/{53-Maximum-Subarray.kt => 0053-maximum-subarray.kt} (100%) rename kotlin/{54-Spiral-Matrix.kt => 0054-spiral-matrix.kt} (100%) rename kotlin/{55-Jump-Game.kt => 0055-jump-game.kt} (100%) rename kotlin/{56-Merge-Intervals.kt => 0056-merge-intervals.kt} (100%) rename kotlin/{62-Unique-Paths.kt => 0062-unique-paths.kt} (100%) rename kotlin/{66-Plus-One.kt => 0066-plus-one.kt} (100%) rename kotlin/{70-Climbing-Stairs.kt => 0070-climbing-stairs.kt} (100%) rename kotlin/{73-Set-Matrix-Zeros.kt => 0073-set-matrix-zeroes.kt} (100%) rename kotlin/{74-Search-A-2D-Matrix.kt => 0074-search-a-2d-matrix.kt} (100%) rename kotlin/{75-Sort-Colors.kt => 0075-sort-colors.kt} (100%) rename kotlin/{76-Minimum-Window-Substring.kt => 0076-minimum-window-substring.kt} (100%) rename kotlin/{78-Subsets.kt => 0078-subsets.kt} (100%) rename kotlin/{79-Word-Search.kt => 0079-word-search.kt} (100%) rename kotlin/{84-Largest-Rectangle-In-Histogram.kt => 0084-largest-rectangle-in-histogram.kt} (100%) rename kotlin/{90-Subsets-II.kt => 0090-subsets-ii.kt} (100%) rename kotlin/{91-Decode-Ways.kt => 0091-decode-ways.kt} (100%) rename kotlin/{98-Validate-Binary-Search-Tree.kt => 0098-validate-binary-search-tree.kt} (100%) rename kotlin/{100-Same-Tree.kt => 0100-same-tree.kt} (100%) rename kotlin/{102-Binary-Tree-Level-Order-Traversal.kt => 0102-binary-tree-level-order-traversal.kt} (100%) rename kotlin/{104-Maximum-Depth-Of-Binary-Tree.kt => 0104-maximum-depth-of-binary-tree.kt} (100%) rename kotlin/{105-Construct-Binary-Tree-From-Preorder-And-Inorder-Traversal.kt => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.kt} (100%) rename kotlin/{110-Balanced-Binary-Tree.kt => 0110-balanced-binary-tree.kt} (100%) rename kotlin/{121-Best-Time-to-Buy-and-Sell-Stocks.kt => 0121-best-time-to-buy-and-sell-stock.kt} (100%) rename kotlin/{124-Binary-Tree-Maximumu-Path-Sum.kt => 0124-binary-tree-maximum-path-sum.kt} (100%) rename kotlin/{125-Valid-Palindrome.kt => 0125-valid-palindrome.kt} (100%) rename kotlin/{127-Word-Ladder.kt => 0127-word-ladder.kt} (100%) rename kotlin/{128-Longest-Consecutive-Sequence.kt => 0128-longest-consecutive-sequence.kt} (100%) rename kotlin/{130-Surrounded-Regions.kt => 0130-surrounded-regions.kt} (100%) rename kotlin/{134-Gas-Station.kt => 0134-gas-station.kt} (100%) rename kotlin/{136-Single-Number.kt => 0136-single-number.kt} (100%) rename kotlin/{138-Copy-List-With-Random-Pointer.kt => 0138-copy-list-with-random-pointer.kt} (100%) rename kotlin/{141-Linked-List-Cycle.kt => 0141-linked-list-cycle.kt} (100%) rename kotlin/{143-Reorder-List.kt => 0143-reorder-list.kt} (100%) rename kotlin/{146-LRU-Cache.kt => 0146-lru-cache.kt} (100%) rename kotlin/{150-Evaluate-Reverse-Polish-Notation.kt => 0150-evaluate-reverse-polish-notation.kt} (100%) rename kotlin/{152-Maximum-Product-Subarray.kt => 0152-maximum-product-subarray.kt} (100%) rename kotlin/{153-Find-Minimum-In-Rotated-Sorted-Array.kt => 0153-find-minimum-in-rotated-sorted-array.kt} (100%) rename kotlin/{155-Min-Stack.kt => 0155-min-stack.kt} (100%) rename kotlin/{167-Two-Sum-2.kt => 0167-two-sum-ii-input-array-is-sorted.kt} (100%) rename kotlin/{190-Reverse-Bits.kt => 0190-reverse-bits.kt} (100%) rename kotlin/{191-Number-Of-1-Bits.kt => 0191-number-of-1-bits.kt} (100%) rename kotlin/{198-House-Robber.kt => 0198-house-robber.kt} (100%) rename kotlin/{199-Binary-Tree-Right-Side-View.kt => 0199-binary-tree-right-side-view.kt} (100%) rename kotlin/{200-Number-Of-Islands.kt => 0200-number-of-islands.kt} (100%) rename kotlin/{202-Happy-Number.kt => 0202-happy-number.kt} (100%) rename kotlin/{206-Reverse-Linked-List.kt => 0206-reverse-linked-list.kt} (100%) rename kotlin/{207-Course-Schedule.kt => 0207-course-schedule.kt} (100%) rename kotlin/{208-Implement-Trie.kt => 0208-implement-trie-prefix-tree.kt} (100%) rename kotlin/{211-Design-Add-And-Search-Words-Data-Structure.kt => 0211-design-add-and-search-words-data-structure.kt} (100%) rename kotlin/{212-Word-Search-II.kt => 0212-word-search-ii.kt} (100%) rename kotlin/{213-House-Robber-II.kt => 0213-house-robber-ii.kt} (100%) rename kotlin/{215-Kth-Largest-Element-In-Array.kt => 0215-kth-largest-element-in-an-array.kt} (100%) rename kotlin/{217-Contains-Duplicate.kt => 0217-contains-duplicate.kt} (100%) rename kotlin/{226-Invert-Binary-Tree.kt => 0226-invert-binary-tree.kt} (100%) rename kotlin/{230-Kth-Smallest-Element-In-A-BST.kt => 0230-kth-smallest-element-in-a-bst.kt} (100%) rename kotlin/{235-Lowest-Common-Ancestor-Of-Binary-Search-Tree.kt => 0235-lowest-common-ancestor-of-a-binary-search-tree.kt} (100%) rename kotlin/{238-Product-Of-Array-Except-Self.kt => 0238-product-of-array-except-self.kt} (100%) rename kotlin/{239-Sliding-Window-Maximum.kt => 0239-sliding-window-maximum.kt} (100%) rename kotlin/{242-Valid-Anagram.kt => 0242-valid-anagram.kt} (100%) rename kotlin/{268-Missing-Number.kt => 0268-missing-number.kt} (100%) rename kotlin/{287-Find-The-Duplicate-Number.kt => 0287-find-the-duplicate-number.kt} (100%) rename kotlin/{295-Find-Median-From-Data-Stream.kt => 0295-find-median-from-data-stream.kt} (100%) rename kotlin/{297-Serialize-And-Deserialize-Binary-Tree.kt => 0297-serialize-and-deserialize-binary-tree.kt} (100%) rename kotlin/{309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.kt => 0309-best-time-to-buy-and-sell-stock-with-cooldown.kt} (100%) rename kotlin/{322-Coin-Change.kt => 0322-coin-change.kt} (100%) rename kotlin/{329-Longest-Increasing-Path-In-A-Matrix.kt => 0329-longest-increasing-path-in-a-matrix.kt} (100%) rename kotlin/{332-Reconstruct-Itinerary.kt => 0332-reconstruct-itinerary.kt} (100%) rename kotlin/{338-Counting-Bits.kt => 0338-counting-bits.kt} (100%) rename kotlin/{347-Top-K-Frequent-Elements.kt => 0347-top-k-frequent-elements.kt} (100%) rename kotlin/{371-Sum-Of-Two-Integers.kt => 0371-sum-of-two-integers.kt} (100%) rename kotlin/{417-Pacific-Atlantic-Waterflow.kt => 0417-pacific-atlantic-water-flow.kt} (100%) rename kotlin/{424-Longest-Repeating-Character-Replacement.kt => 0424-longest-repeating-character-replacement.kt} (100%) rename kotlin/{543-Diameter-of-Binary-Tree.kt => 0543-diameter-of-binary-tree.kt} (100%) rename kotlin/{567-Permutation-In-String.kt => 0567-permutation-in-string.kt} (100%) rename kotlin/{572-Subtree-Of-Another-Tree.kt => 0572-subtree-of-another-tree.kt} (100%) rename kotlin/{684-Redundant-Connection.kt => 0684-redundant-connection.kt} (100%) rename kotlin/{695-Max-Area-Of-Island.kt => 0695-max-area-of-island.kt} (100%) rename kotlin/{704-Binary-Search.kt => 0704-binary-search.kt} (100%) rename kotlin/{739-Daily-Temperatures.kt => 0739-daily-temperatures.kt} (100%) rename kotlin/{746-Min-Cost-Climbing-Stairs.kt => 0746-min-cost-climbing-stairs.kt} (100%) rename kotlin/{787-Cheapest-Flights-Within-K-Stops.kt => 0787-cheapest-flights-within-k-stops.kt} (100%) rename kotlin/{853-Car-Fleet.kt => 0853-car-fleet.kt} (100%) rename kotlin/{875-Koko-Eating-Bananas.kt => 0875-koko-eating-bananas.kt} (100%) rename kotlin/{973-K-Closest-Points-To-Origin.kt => 0973-k-closest-points-to-origin.kt} (100%) rename kotlin/{981-Time-Based-Key-Value-Store.kt => 0981-time-based-key-value-store.kt} (100%) rename kotlin/{994-Rotting-Oranges.kt => 0994-rotting-oranges.kt} (100%) create mode 100644 kotlin/1046-last-stone-weight.kt create mode 100644 kotlin/1143-longest-common-subsequence.kt create mode 100644 kotlin/1448-count-good-nodes-in-binary-tree.kt rename python/{1-Two-Sum.py => 0001-two-sum.py} (100%) rename python/{2-Add-Two-Numbers.py => 0002-add-two-numbers.py} (100%) rename python/{3-Longest-Substring-Without-Repeating-Characters.py => 0003-longest-substring-without-repeating-characters.py} (100%) rename python/{4-median-of-two-sorted-arrays.py => 0004-median-of-two-sorted-arrays.py} (100%) rename python/{5-Longest-Palindromic-Substring.py => 0005-longest-palindromic-substring.py} (100%) rename python/{7-Reverse-Integer.py => 0007-reverse-integer.py} (100%) rename python/{10-Regular-Expression-Matching.py => 0010-regular-expression-matching.py} (100%) rename python/{11-Container-With-Most-Water.py => 0011-container-with-most-water.py} (100%) rename python/{12-Integer-To-Roman.py => 0012-integer-to-roman.py} (100%) rename python/{13-Roman-To-Integer.py => 0013-roman-to-integer.py} (100%) rename python/{14-Longest-Common-Prefix.py => 0014-longest-common-prefix.py} (100%) rename python/{15-3Sum.py => 0015-3sum.py} (100%) rename python/{17-Letter-Combinations-of-a-Phone-Number.py => 0017-letter-combinations-of-a-phone-number.py} (100%) rename python/{18-4Sum.py => 0018-4sum.py} (100%) rename python/{19-Remove-Nth-node-from-end-of-List.py => 0019-remove-nth-node-from-end-of-list.py} (100%) rename python/{20-Valid-Parentheses.py => 0020-valid-parentheses.py} (100%) rename python/{21-Merge-Two-Sorted-Lists.py => 0021-merge-two-sorted-lists.py} (100%) rename python/{22-Generate-Parentheses.py => 0022-generate-parentheses.py} (100%) rename python/{23-Merge-K-Sorted-Lists.py => 0023-merge-k-sorted-lists.py} (100%) rename python/{24-Swap-Nodes-in-Pairs.py => 0024-swap-nodes-in-pairs.py} (100%) rename python/{25-Reverse-Nodes-in-K-Group.py => 0025-reverse-nodes-in-k-group.py} (100%) rename python/{26-Remove-Duplicates-from-Sorted Array.py => 0026-remove-duplicates-from-sorted-array.py} (100%) rename python/{27-Remove-Element.py => 0027-remove-element.py} (100%) rename python/{28-Implement-strStr.py => 0028-find-the-index-of-the-first-occurrence-in-a-string.py} (100%) rename python/{33-Search-In-Rotated-Sorted-Array.py => 0033-search-in-rotated-sorted-array.py} (100%) rename python/{34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py => 0034-find-first-and-last-position-of-element-in-sorted-array.py} (100%) rename python/{35-Search-Insert-Position.py => 0035-search-insert-position.py} (100%) rename python/{36-Valid-Sudoku.py => 0036-valid-sudoku.py} (100%) rename python/{39-Combination-Sum.py => 0039-combination-sum.py} (100%) rename python/{40-Combination-Sum-II.py => 0040-combination-sum-ii.py} (100%) rename python/{41-First-Missing-Positive.py => 0041-first-missing-positive.py} (100%) rename python/{42-Trapping-Rain-Water.py => 0042-trapping-rain-water.py} (100%) rename python/{43-Multiply-Strings.py => 0043-multiply-strings.py} (100%) rename python/{45-Jump-Game-II.py => 0045-jump-game-ii.py} (100%) rename python/{46-Permutations.py => 0046-permutations.py} (100%) rename python/{48-Rotate-Image.py => 0048-rotate-image.py} (100%) rename python/{49-Group-Anagrams.py => 0049-group-anagrams.py} (100%) rename python/{50-Pow(x, n).py => 0050-powx-n.py} (100%) rename python/{51-N-Queens.py => 0051-n-queens.py} (100%) rename python/{53-Maximum-Subarray.py => 0053-maximum-subarray.py} (100%) rename python/{54-Spiral-Matrix.py => 0054-spiral-matrix.py} (100%) rename python/{55-Jump-Game.py => 0055-jump-game.py} (100%) rename python/{56-Merge-Intervals.py => 0056-merge-intervals.py} (100%) rename python/{57-Insert-Interval.py => 0057-insert-interval.py} (100%) rename python/{58-Length-Of-Last-Word.py => 0058-length-of-last-word.py} (100%) rename python/{62-Unique-Paths.py => 0062-unique-paths.py} (100%) rename python/{64-Minimum-Path-Sum.py => 0064-minimum-path-sum.py} (100%) rename python/{66-Plus-One.py => 0066-plus-one.py} (100%) rename python/{70-Climbing-Stairs.py => 0070-climbing-stairs.py} (100%) rename python/{71-Simplify-Path.py => 0071-simplify-path.py} (100%) rename python/{72-Edit-Distance.py => 0072-edit-distance.py} (100%) rename python/{73-Set-Matrix-Zeroes.py => 0073-set-matrix-zeroes.py} (100%) rename python/{74-Search-a-2D-Matrix.py => 0074-search-a-2d-matrix.py} (100%) rename python/{76-Minimum-Window-Substring.py => 0076-minimum-window-substring.py} (100%) rename python/{77-Combinations.py => 0077-combinations.py} (100%) rename python/{78-Subsets.py => 0078-subsets.py} (100%) rename python/{79-Word-Search.py => 0079-word-search.py} (100%) rename python/{83-Remove-Duplicates-From-Sorted-List.py => 0083-remove-duplicates-from-sorted-list.py} (100%) rename python/{84-Largest-Rectangle-in-Histogram.py => 0084-largest-rectangle-in-histogram.py} (100%) rename python/{90-Subsets-II.py => 0090-subsets-ii.py} (100%) rename python/{91-Decode-ways.py => 0091-decode-ways.py} (100%) rename python/{92-Reverse-Linked-List-II.py => 0092-reverse-linked-list-ii.py} (100%) rename python/{94-Binary-Tree-Inorder-Traversal.py => 0094-binary-tree-inorder-traversal.py} (100%) rename python/{97-Interleaving-Strings.py => 0097-interleaving-string.py} (100%) rename python/{98-Validate-Binary-Search-Tree.py => 0098-validate-binary-search-tree.py} (100%) rename python/{100-Same-Tree.py => 0100-same-tree.py} (100%) rename python/{102-Binary-Tree-Level-Order-Traversal.py => 0102-binary-tree-level-order-traversal.py} (100%) rename python/{104-Maximum-Depth-of-Binary-Tree.py => 0104-maximum-depth-of-binary-tree.py} (100%) rename python/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.py} (100%) rename python/{110-Balanced-Binary-Tree.py => 0110-balanced-binary-tree.py} (100%) rename python/{115-Distinct-Subsequences.py => 0115-distinct-subsequences.py} (100%) rename python/{118-Pascal-Triangle.py => 0118-pascals-triangle.py} (100%) rename python/{120-Triangle.py => 0120-triangle.py} (100%) rename python/{121-Best-Time-To-Buy-and-Sell-Stock.py => 0121-best-time-to-buy-and-sell-stock.py} (100%) rename python/{124-Binary-Tree-Maximum-Path-Sum.py => 0124-binary-tree-maximum-path-sum.py} (100%) rename python/{125-Valid-Palindrome.py => 0125-valid-palindrome.py} (100%) rename python/{127-Word-Ladder.py => 0127-word-ladder.py} (100%) rename python/{128-Longest-consecutive-sequence.py => 0128-longest-consecutive-sequence.py} (100%) rename python/{130-Surrounded-Regions.py => 0130-surrounded-regions.py} (100%) rename python/{131-Palindrome-Partitioning.py => 0131-palindrome-partitioning.py} (100%) rename python/{133-Clone-Graph.py => 0133-clone-graph.py} (100%) rename python/{134-Gas-Station.py => 0134-gas-station.py} (100%) rename python/{136-Single-Number.py => 0136-single-number.py} (100%) rename python/{138-Copy-List-With-Random-Pointer.py => 0138-copy-list-with-random-pointer.py} (100%) rename python/{139-Word-Break.py => 0139-word-break.py} (100%) rename python/{141-Linked-List-Cycle.py => 0141-linked-list-cycle.py} (100%) rename python/{143-Reorder-List.py => 0143-reorder-list.py} (100%) rename python/{146-LRU-Cache.py => 0146-lru-cache.py} (100%) rename python/{150-Evaluate-Reverse-Polish-Notation.py => 0150-evaluate-reverse-polish-notation.py} (100%) rename python/{152-Maximum-Product-Subarray.py => 0152-maximum-product-subarray.py} (100%) rename python/{153-Find-Minimum-in-Rotated-Sorted-Array.py => 0153-find-minimum-in-rotated-sorted-array.py} (100%) rename python/{155-Min-Stack.py => 0155-min-stack.py} (100%) rename python/{160-Intersection-of-Two-Linked-Lists.py => 0160-intersection-of-two-linked-lists.py} (100%) rename python/{167-Two-Sum-II.py => 0167-two-sum-ii-input-array-is-sorted.py} (100%) rename python/{169-Majority-Element.py => 0169-majority-element.py} (100%) rename python/{190-Reverse-Bits.py => 0190-reverse-bits.py} (100%) rename python/{191-Number-of-1-Bits.py => 0191-number-of-1-bits.py} (100%) rename python/{198-House-Robber.py => 0198-house-robber.py} (100%) rename python/{199-Binary-Tree-Right-Side-View.py => 0199-binary-tree-right-side-view.py} (100%) rename python/{200-Number-of-Islands.py => 0200-number-of-islands.py} (100%) rename python/{202-Happy-Number.py => 0202-happy-number.py} (100%) rename python/{205-Isomorphic-Strings.py => 0205-isomorphic-strings.py} (100%) rename python/{206-Reverse-Linked-List.py => 0206-reverse-linked-list.py} (100%) rename python/{207-Course-Schedule.py => 0207-course-schedule.py} (100%) rename python/{208-Implement-Trie.py => 0208-implement-trie-prefix-tree.py} (100%) rename python/{210-Course-Schedule-II.py => 0210-course-schedule-ii.py} (100%) rename python/{211-Design-Add-and-Search-Words-Data-Structure.py => 0211-design-add-and-search-words-data-structure.py} (100%) rename python/{212-Word-Search-II.py => 0212-word-search-ii.py} (100%) rename python/{213-House-Robber-II.py => 0213-house-robber-ii.py} (100%) rename python/{215-Kth-Largest-Element-in-an-Array.py => 0215-kth-largest-element-in-an-array.py} (100%) rename python/{217-Contains-Duplicate.py => 0217-contains-duplicate.py} (100%) rename python/{221-Maximal-Square.py => 0221-maximal-square.py} (100%) rename python/{226-Invert-Binary-Tree.py => 0226-invert-binary-tree.py} (100%) rename python/{230-Kth-Smallest-Element-in-a-BST.py => 0230-kth-smallest-element-in-a-bst.py} (100%) rename python/{235-lowest-common-ancestor-of-a-binary-search-tree.py => 0235-lowest-common-ancestor-of-a-binary-search-tree.py} (100%) rename python/{238-Product-of-array-except-self.py => 0238-product-of-array-except-self.py} (100%) rename python/{239-Sliding-Window-Maximum.py => 0239-sliding-window-maximum.py} (100%) rename python/{242-Valid-Anagrams.py => 0242-valid-anagram.py} (100%) rename python/{253-Meeting-Rooms-ii.py => 0253-meeting-rooms.py} (100%) rename python/{261-Graph-Valid-Tree.py => 0261-graph-valid-tree.py} (100%) rename python/{268-Missing-Number.py => 0268-missing-number.py} (100%) rename python/{269-Alien-Dictionary.py => 0269-alien-dictionary.py} (100%) rename python/{271-Encode-and-Decode-Strings.py => 0271-encode-and-decode-strings.py} (100%) rename python/{286-Walls-and-Gates.py => 0286-walls-and-gates.py} (100%) rename python/{287-Find-The-Duplicate-Number.py => 0287-find-the-duplicate-number.py} (100%) rename python/{290-Word-Pattern.py => 0290-word-pattern.py} (100%) rename python/{295-Find-Median-from-Data-Stream.py => 0295-find-median-from-data-stream.py} (100%) rename python/{297-Serialize-and-Deserialize-Binary-Tree.py => 0297-serialize-and-deserialize-binary-tree.py} (100%) rename python/{300-Longest-Increasing-Subsequence.py => 0300-longest-increasing-subsequence.py} (100%) rename python/{309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py => 0309-best-time-to-buy-and-sell-stock-with-cooldown.py} (100%) rename python/{312-Burst-Balloons.py => 0312-burst-balloons.py} (100%) rename python/{322-Coin-Change.py => 0322-coin-change.py} (100%) rename python/{323-Number-of-Connected-Components-in-an-Undirected-Graph.py => 0323-number-of-connected-components-in-an-undirected-graph.py} (100%) rename python/{329-Longest-Increasing-Path-in-a-Matrix.py => 0329-longest-increasing-path-in-a-matrix.py} (100%) rename python/{332-Reconstruct-Itinerary.py => 0332-reconstruct-itinerary.py} (100%) rename python/{338-Counting-Bits.py => 0338-counting-bits.py} (100%) rename python/{344-Reverse-String.py => 0344-reverse-string.py} (100%) rename python/{347-Top-k-frequent-elements.py => 0347-top-k-frequent-elements.py} (100%) rename python/{355-Design-Twitter.py => 0355-design-twitter.py} (100%) rename python/{367-Valid-Perfect-Square.py => 0367-valid-perfect-square.py} (100%) rename python/{371-Sum-of-Two-Integers.py => 0371-sum-of-two-integers.py} (100%) rename python/{374-Guess-Number-Higher-Or-Lower.py => 0374-guess-number-higher-or-lower.py} (100%) rename python/{377-Combination-Sum-IV.py => 0377-combination-sum-iv.py} (100%) rename python/{392-Is-Subsequence.py => 0392-is-subsequence.py} (100%) rename python/{394-decode-string.py => 0394-decode-string.py} (100%) rename python/{410-Split-Array-Largest-Sum.py => 0410-split-array-largest-sum.py} (100%) rename python/{416-Partition-Equal-Subset-Sum.py => 0416-partition-equal-subset-sum.py} (100%) rename python/{417-Pacific-Atlantic-Waterflow.py => 0417-pacific-atlantic-water-flow.py} (100%) rename python/{424-Longest-Repeating-Character-Replacement.py => 0424-longest-repeating-character-replacement.py} (100%) rename python/{435-Non-Overlapping-Intervals.py => 0435-non-overlapping-intervals.py} (100%) rename python/{438-Find-All-Anagrams-In-A-String.py => 0438-find-all-anagrams-in-a-string.py} (100%) rename python/{441-Arranging-Coin.py => 0441-arranging-coins.py} (100%) rename python/{448-Find-all-Numbers-Disappeared-in-an-Array.py => 0448-find-all-numbers-disappeared-in-an-array.py} (100%) rename python/{463-Island-Perimeter.py => 0463-island-perimeter.py} (100%) rename python/{473-Matchsticks-to-Square.py => 0473-matchsticks-to-square.py} (100%) rename python/{494-Target-Sum.py => 0494-target-sum.py} (100%) rename python/{496-Next-Greater-Element-I.py => 0496-next-greater-element-i.py} (100%) rename python/{518-coin-change-2.py => 0518-coin-change-ii.py} (100%) rename python/{523-Continuous-Subarray-Sum.py => 0523-continuous-subarray-sum.py} (100%) rename python/{543-Diameter-of-Binary-Tree.py => 0543-diameter-of-binary-tree.py} (100%) rename python/{567-Permutation-in-String.py => 0567-permutation-in-string.py} (100%) rename python/{572-Subtree-of-Another-Tree.py => 0572-subtree-of-another-tree.py} (100%) rename python/{605-Can-Place-Flowers.py => 0605-can-place-flowers.py} (100%) rename python/{617-Merge-Two-Binary-Trees.py => 0617-merge-two-binary-trees.py} (100%) rename python/{621-Task-Scheduler.py => 0621-task-scheduler.py} (100%) rename python/{647-Palindromic-Substrings.py => 0647-palindromic-substrings.py} (100%) rename python/{658-Find-K-Closest-Elements.py => 0658-find-k-closest-elements.py} (100%) rename python/{669-Trim-a-Binary-Search-Tree.py => 0669-trim-a-binary-search-tree.py} (100%) rename python/{673-Number-of-Longest-Increasing-Subsequence.py => 0673-number-of-longest-increasing-subsequence.py} (100%) rename python/{678-Valid-Parenthesis-String.py => 0678-valid-parenthesis-string.py} (100%) rename python/{680-Valid-Palindrome-II.py => 0680-valid-palindrome-ii.py} (100%) rename python/{682-Baseball-Game.py => 0682-baseball-game.py} (100%) rename python/{684-Redundant-Connection.py => 0684-redundant-connection.py} (100%) rename python/{695-Max-Area-of-Island.py => 0695-max-area-of-island.py} (100%) rename python/{703-Kth-Largest-Element-in-a-Stream.py => 0703-kth-largest-element-in-a-stream.py} (100%) rename python/{704-Binary-Search.py => 0704-binary-search.py} (100%) rename python/{724-Find-Pivot-Index.py => 0724-find-pivot-index.py} (100%) rename python/{739-Daily-Temperatures.py => 0739-daily-temperatures.py} (100%) rename python/{743-Network-Delay-Time.py => 0743-network-delay-time.py} (100%) rename python/{746-Min-Cost-Climbing-Stairs.py => 0746-min-cost-climbing-stairs.py} (100%) rename python/{752-Open-the-Lock.py => 0752-open-the-lock.py} (100%) rename python/{763-Partition-Labels.py => 0763-partition-labels.py} (100%) rename python/{767-Reorganize-String.py => 0767-reorganize-string.py} (100%) rename python/{778-Swim-in-Rising-Water.py => 0778-swim-in-rising-water.py} (100%) rename python/{787-Cheapest-Flights-within-K-stops.py => 0787-cheapest-flights-within-k-stops.py} (100%) rename python/{846-Hand-of-Straights.py => 0846-hand-of-straights.py} (100%) rename python/{853-Car-Fleet.py => 0853-car-fleet.py} (100%) rename python/{875-Koko-Eating-Bananas.py => 0875-koko-eating-bananas.py} (100%) rename python/{901-Online-Stock-Span.py => 0901-online-stock-span.py} (100%) rename python/{909-Snakes-and-Ladders.py => 0909-snakes-and-ladders.py} (100%) rename python/{919-Meeting-Rooms-II.py => 0919-meeting-rooms-ii.py} (100%) rename python/{929-Unique-Email-Addresses.py => 0929-unique-email-addresses.py} (100%) rename python/{973-K-Closest-Points-to-Origin.py => 0973-k-closest-points-to-origin.py} (100%) rename python/{977-Squares-Of-A-Sorted-Array.py => 0977-squares-of-a-sorted-array.py} (100%) rename python/{981-Time-Based-Key-Value-Store.py => 0981-time-based-key-value-store.py} (100%) rename python/{994-Rotting-Oranges.py => 0994-rotting-oranges.py} (100%) create mode 100644 python/1046-last-stone-weight.py create mode 100644 python/1143-longest-common-subsequence.py create mode 100644 python/1189-maximum-number-of-balloons.py create mode 100644 python/1209-remove-all-adjacent-duplicates-in-string-ii.py create mode 100644 python/1220-count-vowels-permutation.py create mode 100644 python/1239-maximum-length-of-a-concatenated-string-with-unique-characters.py create mode 100644 python/1299-replace-elements-with-greatest-element-on-right-side.py create mode 100644 python/1383-maximum-performance-of-a-team.py create mode 100644 python/1448-count-good-nodes-in-binary-tree.py create mode 100644 python/1584-min-cost-to-connect-all-points.py create mode 100644 python/1845-seat-reservation-manager.py create mode 100644 python/1849-splitting-a-string-into-descending-consecutive-values.py create mode 100644 python/1851-minimum-interval-to-include-each-query.py create mode 100644 python/1905-count-sub-islands.py create mode 100644 python/1980-find-unique-binary-string.py create mode 100644 python/1985-find-the-kth-largest-integer-in-the-array.py create mode 100644 python/2013-detect-squares.py create mode 100644 python/2017-grid-game.py rename ruby/{1-Two-Sum.rb => 0001-two-sum.rb} (100%) rename ruby/{2-Add-Two-Numbers.rb => 0002-add-two-numbers.rb} (100%) rename ruby/{3-Longest-Substring-Without-Repeating-Characters.rb => 0003-longest-substring-without-repeating-characters.rb} (100%) rename ruby/{7-Reverse-Integer.rb => 0007-reverse-integer.rb} (100%) rename ruby/{11-Container-With-Most-Water.rb => 0011-container-with-most-water.rb} (100%) rename ruby/{15-3Sum.rb => 0015-3sum.rb} (100%) rename ruby/{17-Letter-Combinations-Of-A-Phone-Number.rb => 0017-letter-combinations-of-a-phone-number.rb} (100%) rename ruby/{20-Valid-Parentheses.rb => 0020-valid-parentheses.rb} (100%) rename ruby/{21-Merge-Two-Sorted-Lists.rb => 0021-merge-two-sorted-lists.rb} (100%) rename ruby/{22-Generate-Parentheses.rb => 0022-generate-parentheses.rb} (100%) rename ruby/{36-Valid-Sudoku.rb => 0036-valid-sudoku.rb} (100%) rename ruby/{42-Trapping-Rain-Water.rb => 0042-trapping-rain-water.rb} (100%) rename ruby/{49-Group-Anagrams.rb => 0049-group-anagrams.rb} (100%) create mode 100644 ruby/0053-maximum-subarray.rb rename ruby/{70-Climbing-Stairs.rb => 0070-climbing-stairs.rb} (100%) rename ruby/{74-Search-a-2D-Matrix.rb => 0074-search-a-2d-matrix.rb} (100%) rename ruby/{78-Subsets.rb => 0078-subsets.rb} (100%) rename ruby/{94-Binary-Tree-Inorder-Traversal.rb => 0094-binary-tree-inorder-traversal.rb} (100%) rename ruby/{100-Same-Tree.rb => 0100-same-tree.rb} (100%) rename ruby/{102-Binary-Tree-Level-Order-Traversal.rb => 0102-binary-tree-level-order-traversal.rb} (100%) rename ruby/{104-Maximum-Depth-of-Binary-Tree.rb => 0104-maximum-depth-of-binary-tree.rb} (100%) rename ruby/{110-Balanced-Binary-Tree.rb => 0110-balanced-binary-tree.rb} (100%) rename ruby/{121-Best-Time-To-Buy-and-Sell-Stock.rb => 0121-best-time-to-buy-and-sell-stock.rb} (100%) rename ruby/{125-Valid-Palindrome.rb => 0125-valid-palindrome.rb} (100%) rename ruby/{128-Longest-consecutive-sequence.rb => 0128-longest-consecutive-sequence.rb} (100%) rename ruby/{133-Clone-Graph.rb => 0133-clone-graph.rb} (100%) rename ruby/{136-Single-Number.rb => 0136-single-number.rb} (100%) rename ruby/{138-Copy-List-With-Random-Pointer.rb => 0138-copy-list-with-random-pointer.rb} (100%) rename ruby/{141-Linked-List-Cycle.rb => 0141-linked-list-cycle.rb} (100%) rename ruby/{146-LRU-Cache.rb => 0146-lru-cache.rb} (100%) rename ruby/{150-Evaluate-Reverse-Polish-Notation.rb => 0150-evaluate-reverse-polish-notation.rb} (100%) rename ruby/{152-Maximum-Product-Subarray.rb => 0152-maximum-product-subarray.rb} (100%) rename ruby/{155-Min-Stack.rb => 0155-min-stack.rb} (100%) rename ruby/{167-Two-Sum-II.rb => 0167-two-sum-ii-input-array-is-sorted.rb} (100%) rename ruby/{190-Reverse-Bits.rb => 0190-reverse-bits.rb} (100%) rename ruby/{191-Number-of-1-Bits.rb => 0191-number-of-1-bits.rb} (100%) rename ruby/{198-House-Robber.rb => 0198-house-robber.rb} (100%) rename ruby/{200-Number-of-Islands.rb => 0200-number-of-islands.rb} (100%) rename ruby/{206-Reverse-Linked-List.rb => 0206-reverse-linked-list.rb} (100%) rename ruby/{208-Implement-Trie.rb => 0208-implement-trie-prefix-tree.rb} (100%) rename ruby/{211-Design-Add-and-Search-Words-Data-Structure.rb => 0211-design-add-and-search-words-data-structure.rb} (100%) rename ruby/{213-House-Robber-II.rb => 0213-house-robber-ii.rb} (100%) rename ruby/{217-Contains-Duplicate.rb => 0217-contains-duplicate.rb} (100%) rename ruby/{226-Invert-Binary-Tree.rb => 0226-invert-binary-tree.rb} (100%) rename ruby/{235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.rb => 0235-lowest-common-ancestor-of-a-binary-search-tree.rb} (100%) rename ruby/{238-Product-of-array-except-self.rb => 0238-product-of-array-except-self.rb} (100%) rename ruby/{242-Valid-Anagrams.rb => 0242-valid-anagram.rb} (100%) rename ruby/{268-Missing-Number.rb => 0268-missing-number.rb} (100%) rename ruby/{271-Encode-and-Decode-Strings.rb => 0271-encode-and-decode-strings.rb} (100%) rename ruby/{287-Find-The-Duplicate-Number.rb => 0287-find-the-duplicate-number.rb} (100%) rename ruby/{338-Counting-Bits.rb => 0338-counting-bits.rb} (100%) rename ruby/{347-Top-k-frequent-elements.rb => 0347-top-k-frequent-elements.rb} (100%) rename ruby/{371-Sum-of-Two-Integers.rb => 0371-sum-of-two-integers.rb} (100%) rename ruby/{424-Longest-Repeating-Character-Replacement.rb => 0424-longest-repeating-character-replacement.rb} (100%) rename ruby/{543-Diameter-of-Binary-Tree.rb => 0543-diameter-of-binary-tree.rb} (100%) rename ruby/{572-Subtree-of-Another-Tree.rb => 0572-subtree-of-another-tree.rb} (100%) rename ruby/{703-Kth-Largest-Element-in-a-Stream.rb => 0703-kth-largest-element-in-a-stream.rb} (100%) rename ruby/{704-Binary-Search.rb => 0704-binary-search.rb} (100%) rename ruby/{739-Daily-Temperatures.rb => 0739-daily-temperatures.rb} (100%) rename ruby/{746-Min-Cost-Climbing-Stairs.rb => 0746-min-cost-climbing-stairs.rb} (100%) rename ruby/{853-Car-Fleet.rb => 0853-car-fleet.rb} (100%) rename ruby/{875-Koko-Eating-Bananas.rb => 0875-koko-eating-bananas.rb} (100%) create mode 100644 ruby/0981-time-based-key-value-store.rb create mode 100644 ruby/1046-last-stone-weight.rb create mode 100644 ruby/1584-min-cost-to-connect-all-points.rb rename rust/{1-Two-Sum.rs => 0001-two-sum.rs} (100%) rename rust/{3-Longest-Substring-Without-Repeating-Characters.rs => 0003-longest-substring-without-repeating-characters.rs} (100%) rename rust/{5-Longest-Palindromic-Substring.rs => 0005-longest-palindromic-substring.rs} (100%) rename rust/{11-Container-With-Most-Water.rs => 0011-container-with-most-water.rs} (100%) rename rust/{15-3sum.rs => 0015-3sum.rs} (100%) rename rust/{20-Valid-Parentheses.rs => 0020-valid-parentheses.rs} (100%) rename rust/{33-Search-In-Rotated-Sorted-Array.rs => 0033-search-in-rotated-sorted-array.rs} (100%) rename rust/{36-Valid-Sudoku.rs => 0036-valid-sudoku.rs} (100%) rename rust/{49-Group-Anagrams.rs => 0049-group-anagrams.rs} (100%) rename rust/{53-Maximum-Subarray.rs => 0053-maximum-subarray.rs} (100%) rename rust/{55-Jump-Game.rs => 0055-jump-game.rs} (100%) rename rust/{57-Insert-Interval.rs => 0057-insert-interval.rs} (100%) rename rust/{58-Length-of-Last-Word.rs => 0058-length-of-last-word.rs} (100%) rename rust/{62-Unique-Paths.rs => 0062-unique-paths.rs} (100%) rename rust/{70-Climbing-Stairs.rs => 0070-climbing-stairs.rs} (100%) rename rust/{76-Minimum-Window-Substring.rs => 0076-minimum-window-substring.rs} (100%) rename rust/{84-Largest-Rectangle-In-Histogram.rs => 0084-largest-rectangle-in-histogram.rs} (100%) rename rust/{118-Pascals-Triangle.rs => 0118-pascals-triangle.rs} (100%) rename rust/{121-Best-Time-To-Buy.rs => 0121-best-time-to-buy-and-sell-stock.rs} (100%) rename rust/{125-Valid-Palindrome.rs => 0125-valid-palindrome.rs} (100%) rename rust/{128-Longest-Consecutive-Sequence.rs => 0128-longest-consecutive-sequence.rs} (100%) rename rust/{152-Maximum-Product-Subarray.rs => 0152-maximum-product-subarray.rs} (100%) rename rust/{153-Find-Minimum-In-Rotated-Sorted-Array.rs => 0153-find-minimum-in-rotated-sorted-array.rs} (100%) rename rust/{167-Two-Sum-II.rs => 0167-two-sum-ii-input-array-is-sorted.rs} (100%) rename rust/{190-Reverse-Bits.rs => 0190-reverse-bits.rs} (100%) rename rust/{191-Number-Of-1-Bits.rs => 0191-number-of-1-bits.rs} (100%) rename rust/{198-House-Robber.rs => 0198-house-robber.rs} (100%) rename rust/{208-Implement-Trie.rs => 0208-implement-trie-prefix-tree.rs} (100%) rename rust/{211-Design-Add-And-Search-Words-Data-Structure.rs => 0211-design-add-and-search-words-data-structure.rs} (100%) rename rust/{212-Word-Search-II.rs => 0212-word-search-ii.rs} (100%) rename rust/{213-House-Robber-II.rs => 0213-house-robber-ii.rs} (100%) rename rust/{217-Contains-Duplicates.rs => 0217-contains-duplicate.rs} (100%) rename rust/{238-Product-Of-Array-Except-Self.rs => 0238-product-of-array-except-self.rs} (100%) rename rust/{242-Valid-Anagram.rs => 0242-valid-anagram.rs} (100%) rename rust/{253-Meeting-Rooms.rs => 0253-meeting-rooms.rs} (100%) rename rust/{268-Missing-Number.rs => 0268-missing-number.rs} (100%) rename rust/{271-Encode-And-Decode-Strings.rs => 0271-encode-and-decode-strings.rs} (100%) rename rust/{322-Coin-Change.rs => 0322-coin-change.rs} (100%) rename rust/{338-Counting-Bits.rs => 0338-counting-bits.rs} (100%) rename rust/{347-Top-K-Frequent-Elements.rs => 0347-top-k-frequent-elements.rs} (100%) rename rust/{371-Sum-of-Two-Integers.rs => 0371-sum-of-two-integers.rs} (100%) rename rust/{392-Is-Subsequence.rs => 0392-is-subsequence.rs} (100%) rename rust/{424-Longest-Repeating-Character-Replacement.rs => 0424-longest-repeating-character-replacement.rs} (100%) rename rust/{647-Palindromic-Substrings.rs => 0647-palindromic-substrings.rs} (100%) rename rust/{746-Min-Cost-Climbing-Stairs.rs => 0746-min-cost-climbing-stairs.rs} (100%) create mode 100644 rust/1143-longest-common-subsequence.rs create mode 100644 rust/1299-replace-elements-with-greatest-element-on-right-side.rs rename scala/{1-Two-Sum.scala => 0001-two-sum.scala} (100%) rename scala/{2-Add-Two-Numbers.scala => 0002-add-two-numbers.scala} (100%) rename scala/{3-Longest-Substring-Without-Repeating-Characters.scala => 0003-longest-substring-without-repeating-characters.scala} (100%) rename scala/{7-Reverse-Integer.scala => 0007-reverse-integer.scala} (100%) rename scala/{15-3Sum.scala => 0015-3sum.scala} (100%) rename scala/{21-Merge-Two-Sorted-Lists.scala => 0021-merge-two-sorted-lists.scala} (100%) rename scala/{33-Search-in-Rotated-Sorted-Array.scala => 0033-search-in-rotated-sorted-array.scala} (100%) rename scala/{56-Merge-Intervals.scala => 0056-merge-intervals.scala} (100%) rename scala/{91-Decode-Ways.scala => 0091-decode-ways.scala} (100%) rename scala/{141-Linked-List-Cycle.scala => 0141-linked-list-cycle.scala} (100%) rename scala/{153-Find-Minimum-In-Rotated-Sorted-Array.scala => 0153-find-minimum-in-rotated-sorted-array.scala} (100%) rename scala/{198-House-Robber.scala => 0198-house-robber.scala} (100%) rename scala/{206-Reverse-Linked-List.scala => 0206-reverse-linked-list.scala} (100%) rename scala/{213-House-Robber-II.scala => 0213-house-robber-ii.scala} (100%) rename scala/{217-Contains-Duplicate.scala => 0217-contains-duplicate.scala} (100%) rename scala/{235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.scala => 0235-lowest-common-ancestor-of-a-binary-search-tree.scala} (100%) rename scala/{435-Non-Overlapping-Intervals.scala => 0435-non-overlapping-intervals.scala} (100%) rename scala/{572-Subtree-of-Another-Tree.scala => 0572-subtree-of-another-tree.scala} (100%) rename swift/{1-Two-Sum.swift => 0001-two-sum.swift} (100%) rename swift/{2-Add-Two-Numbers.swift => 0002-add-two-numbers.swift} (100%) rename swift/{3-Longest-Substring-Without-Repeating-Characters.swift => 0003-longest-substring-without-repeating-characters.swift} (100%) rename swift/{7-Reverse-Integer.swift => 0007-reverse-integer.swift} (100%) rename swift/{11-Container-With-Most-Water.swift => 0011-container-with-most-water.swift} (100%) rename swift/{15-3Sum.swift => 0015-3sum.swift} (100%) rename swift/{19-Remove-Nth-Node-From-End-of-List.swift => 0019-remove-nth-node-from-end-of-list.swift} (100%) rename swift/{20-Valid-Parentheses => 0020-valid-parentheses.swift} (100%) rename swift/{21-Merge-Two-Sorted-Lists.swift => 0021-merge-two-sorted-lists.swift} (100%) rename swift/{33-Search-in-Rotated-Sorted-Array.swift => 0033-search-in-rotated-sorted-array.swift} (100%) rename swift/{35-Valid-Sudoku.swift => 0035-search-insert-position.swift} (100%) rename swift/{42-Trapping-Rain-Water.swift => 0042-trapping-rain-water.swift} (100%) rename swift/{43-Multiply-Strings.swift => 0043-multiply-strings.swift} (100%) rename swift/{45-Jump-Game-II.swift => 0045-jump-game-ii.swift} (100%) rename swift/{46-Permutations.swift => 0046-permutations.swift} (100%) rename swift/{48-Rotate-Image.swift => 0048-rotate-image.swift} (100%) rename swift/{49-Group-Anagrams.swift => 0049-group-anagrams.swift} (100%) rename swift/{50-Pow(x, n).swift => 0050-powx-n.swift} (100%) rename swift/{53-Maximum-Subarray.swift => 0053-maximum-subarray.swift} (100%) rename swift/{55-Jump-Game.swift => 0055-jump-game.swift} (100%) rename swift/{57-Insert-Interval.swift => 0057-insert-interval.swift} (100%) rename swift/{66-Plus-One.swift => 0066-plus-one.swift} (100%) rename swift/{70-Climbing-Stairs.swift => 0070-climbing-stairs.swift} (100%) rename swift/{72-Edit-Distance.swift => 0072-edit-distance.swift} (100%) rename swift/{74-Search-A-2D-Matrix.swift => 0074-search-a-2d-matrix.swift} (100%) rename swift/{78-Subsets.swift => 0078-subsets.swift} (100%) rename swift/{79-Word-Search.swift => 0079-word-search.swift} (100%) rename swift/{98-Validate-Binary-Search-Tree.swift => 0098-validate-binary-search-tree.swift} (100%) rename swift/{100-Same-Tree.swift => 0100-same-tree.swift} (100%) rename swift/{102-Binary-Tree-Level-Order-Traversal.swift => 0102-binary-tree-level-order-traversal.swift} (100%) rename swift/{104-Maximum-Depth-of-Binary-Tree.swift => 0104-maximum-depth-of-binary-tree.swift} (100%) rename swift/{110-Balanced-Binary-Tree.swift => 0110-balanced-binary-tree.swift} (100%) rename swift/{121-Best-Time-To-Buy-And-Sell-Stock.swift => 0121-best-time-to-buy-and-sell-stock.swift} (100%) rename swift/{124-Binary-Tree-Maximum-Path-Sum.swift => 0124-binary-tree-maximum-path-sum.swift} (100%) rename swift/{125-Valid-Palindrome.swift => 0125-valid-palindrome.swift} (100%) rename swift/{128-Longest-Consecutive-Sequence.swift => 0128-longest-consecutive-sequence.swift} (100%) rename swift/{130-Surrounded-Regions.swift => 0130-surrounded-regions.swift} (100%) rename swift/{133-Clone-Graph.swift => 0133-clone-graph.swift} (100%) rename swift/{134-Gas-Station.swift => 0134-gas-station.swift} (100%) rename swift/{136-Single-Number.swift => 0136-single-number.swift} (100%) rename swift/{138-Copy-List-with-Random-Pointer.swift => 0138-copy-list-with-random-pointer.swift} (100%) rename swift/{141-Linked-List-Cycle.swift => 0141-linked-list-cycle.swift} (100%) rename swift/{150-Evaluate-Reverse-Polish-Notation.swift => 0150-evaluate-reverse-polish-notation.swift} (100%) rename swift/{152-Maximum-Product-Subarray.swift => 0152-maximum-product-subarray.swift} (100%) rename swift/{153-Find-Minimum-in-Rotated-Sorted-Array.swift => 0153-find-minimum-in-rotated-sorted-array.swift} (100%) rename swift/{167-Two-Sum-II-Input-Array-Is-Sorted.swift => 0167-two-sum-ii-input-array-is-sorted.swift} (100%) rename swift/{169-Majority-Element.swift => 0169-majority-element.swift} (100%) rename swift/{190-Reverse-Bits.swift => 0190-reverse-bits.swift} (100%) rename swift/{191-Number-of-1-Bits.swift => 0191-number-of-1-bits.swift} (100%) rename swift/{198-House-Robber.swift => 0198-house-robber.swift} (100%) rename swift/{199-Binary-Tree-Right-Side-View.swift => 0199-binary-tree-right-side-view.swift} (100%) rename swift/{200-Number-of-Islands.swift => 0200-number-of-islands.swift} (100%) rename swift/{202-Happy-Number.swift => 0202-happy-number.swift} (100%) rename swift/{205-Isomorphic-Strings.swift => 0205-isomorphic-strings.swift} (100%) rename swift/{206-Reverse-Linked-List.swift => 0206-reverse-linked-list.swift} (100%) rename swift/{207-Course-Schedule.swift => 0207-course-schedule.swift} (100%) rename swift/{208-Implement-Trie-(Prefix-Tree).swift => 0208-implement-trie-prefix-tree.swift} (100%) rename swift/{212-Word-Search-II.swift => 0212-word-search-ii.swift} (100%) rename swift/{213-House-Robber-II.swift => 0213-house-robber-ii.swift} (100%) rename swift/{217-Contains-Duplicate.swift => 0217-contains-duplicate.swift} (100%) rename swift/{226-Invert-Binary-Tree => 0226-invert-binary-tree.swift} (100%) rename swift/{230-Kth-Smallest-Element-In-A-BST.swift => 0230-kth-smallest-element-in-a-bst.swift} (100%) rename swift/{235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.swift => 0235-lowest-common-ancestor-of-a-binary-search-tree.swift} (100%) rename swift/{238-Product-of-array-except-self.swift => 0238-product-of-array-except-self.swift} (100%) rename swift/{242-Valid-Anagram.swift => 0242-valid-anagram.swift} (100%) rename swift/{261-Graph-Valid-Tree.swift => 0261-graph-valid-tree.swift} (100%) rename swift/{268-Missing-Number.swift => 0268-missing-number.swift} (100%) rename swift/{271-Encode-and-Decode-Strings.swift => 0271-encode-and-decode-strings.swift} (100%) rename swift/{287-Find-The-Duplicate-Number.swift => 0287-find-the-duplicate-number.swift} (100%) rename swift/{309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.swift => 0309-best-time-to-buy-and-sell-stock-with-cooldown.swift} (100%) rename swift/{323-Number-of-Connected-Components-in-an-Undirected-Graph.swift => 0323-number-of-connected-components-in-an-undirected-graph.swift} (100%) rename swift/{338-Counting-Bits.swift => 0338-counting-bits.swift} (100%) rename swift/{344-Reverse-String.swift => 0344-reverse-string.swift} (100%) rename swift/{347-Top-k-frequent-elements.swift => 0347-top-k-frequent-elements.swift} (100%) rename swift/{371-Sum-Of-Two-Integers.swift => 0371-sum-of-two-integers.swift} (100%) rename swift/{543-Diameter-of-Binary-Tree.swift => 0543-diameter-of-binary-tree.swift} (100%) rename swift/{572-Subtree-of-Another-Tree.swift => 0572-subtree-of-another-tree.swift} (100%) rename swift/{703-Kth-Largest-Element-In-A-Stream.swift => 0703-kth-largest-element-in-a-stream.swift} (100%) rename swift/{704-Binary-Search => 0704-binary-search.swift} (100%) rename swift/{739-Daily-Temperatures.swift => 0739-daily-temperatures.swift} (100%) rename swift/{746-Min-Cost-Climbing-Stairs.swift => 0746-min-cost-climbing-stairs.swift} (100%) rename swift/{875-Koko-Eating-Bananas.swift => 0875-koko-eating-bananas.swift} (100%) rename swift/{929-Unique-Email-Addresses.swift => 0929-unique-email-addresses.swift} (100%) create mode 100644 swift/1143-longest-common-subsequence.swift delete mode 100644 swift/121-Best-Time-to-Buy-and-Sell-Stock.swift delete mode 100644 swift/1448-Count-Good-Nodes-In-Binary-Tree-2.swift rename swift/{1448-Count-Good-Nodes-in-Binary-Tree-1.swift => 1448-count-good-nodes-in-binary-tree.swift} (100%) create mode 100644 swift/1584-min-cost-to-connect-all-points.swift create mode 100644 swift/1985-find-the-kth-largest-integer-in-the-array.swift rename typescript/{1-Two-Sum.ts => 0001-two-sum.ts} (100%) rename typescript/{2-Add-Two-Numbers.ts => 0002-add-two-numbers.ts} (100%) rename typescript/{3-Longest-Substring-Without-Repeating-Characters.ts => 0003-longest-substring-without-repeating-characters.ts} (100%) rename typescript/{4-Median-of-Two-Sorted-Arrays.ts => 0004-median-of-two-sorted-arrays.ts} (100%) rename typescript/{5-Longest-Palindromic-Substring.ts => 0005-longest-palindromic-substring.ts} (100%) rename typescript/{7-Reverse-Integer.ts => 0007-reverse-integer.ts} (100%) rename typescript/{9-Palindrome-Number.ts => 0009-palindrome-number.ts} (100%) rename typescript/{10-Regular-Expression-Matching.ts => 0010-regular-expression-matching.ts} (100%) rename typescript/{11-Container-With-Most-Water.ts => 0011-container-with-most-water.ts} (100%) rename typescript/{15-3Sum.ts => 0015-3sum.ts} (100%) rename typescript/{17-Letter-Combinations-of-a-Phone-Number.ts => 0017-letter-combinations-of-a-phone-number.ts} (100%) rename typescript/{19-Remove-Nth-Node-From-End-of-List.ts => 0019-remove-nth-node-from-end-of-list.ts} (100%) rename typescript/{20-Valid-Parentheses.ts => 0020-valid-parentheses.ts} (100%) rename typescript/{21-Merge-Two-Sorted-Lists.ts => 0021-merge-two-sorted-lists.ts} (100%) rename typescript/{22-Generate-Parentheses.ts => 0022-generate-parentheses.ts} (100%) rename typescript/{23-Merge-k-Sorted-Lists.ts => 0023-merge-k-sorted-lists.ts} (100%) rename typescript/{25-Reverse-Nodes-in-k-Group.ts => 0025-reverse-nodes-in-k-group.ts} (100%) rename typescript/{27-Remove-Element.ts => 0027-remove-element.ts} (100%) rename typescript/{33-Search-in-Rotated-Sorted-Array.ts => 0033-search-in-rotated-sorted-array.ts} (100%) rename typescript/{36-Valid-Sudoku.ts => 0036-valid-sudoku.ts} (100%) rename typescript/{39-Combination-Sum.ts => 0039-combination-sum.ts} (100%) rename typescript/{40-Combination-Sum-II.ts => 0040-combination-sum-ii.ts} (100%) rename typescript/{41-First-Missing-Positive.ts => 0041-first-missing-positive.ts} (100%) rename typescript/{42-Trapping-Rain-Water.ts => 0042-trapping-rain-water.ts} (100%) rename typescript/{43-Multiply-Strings.ts => 0043-multiply-strings.ts} (100%) rename typescript/{45-Jump-Game-II.ts => 0045-jump-game-ii.ts} (100%) rename typescript/{46-Permutations.ts => 0046-permutations.ts} (100%) rename typescript/{48-Rotate-Image.ts => 0048-rotate-image.ts} (100%) rename typescript/{49-Group-Anagrams.ts => 0049-group-anagrams.ts} (100%) rename typescript/{50-Pow.ts => 0050-powx-n.ts} (100%) rename typescript/{51-N-Queens => 0051-n-queens.ts} (100%) rename typescript/{53-Maximum-Subarray.ts => 0053-maximum-subarray.ts} (100%) rename typescript/{54-Spiral-Matrix.ts => 0054-spiral-matrix.ts} (100%) rename typescript/{55-Jump-Game.ts => 0055-jump-game.ts} (100%) rename typescript/{56-Merge-Intervals.ts => 0056-merge-intervals.ts} (100%) rename typescript/{57-Insert-Interval.ts => 0057-insert-interval.ts} (100%) rename typescript/{58-Length-Of-Last-Word.ts => 0058-length-of-last-word.ts} (100%) rename typescript/{62-Unique-Paths.ts => 0062-unique-paths.ts} (100%) rename typescript/{66-Plus-One.ts => 0066-plus-one.ts} (100%) rename typescript/{70-Climbing-Stairs.ts => 0070-climbing-stairs.ts} (100%) rename typescript/{71-Simplify-Path.ts => 0071-simplify-path.ts} (100%) rename typescript/{73-Set-Matrix-Zeroes.ts => 0073-set-matrix-zeroes.ts} (100%) rename typescript/{74-Search-a-2D-Matrix.ts => 0074-search-a-2d-matrix.ts} (100%) rename typescript/{76-Minimum-Window-Substring.ts => 0076-minimum-window-substring.ts} (100%) rename typescript/{78-Subsets.ts => 0078-subsets.ts} (100%) rename typescript/{84-Largest-Rectangle-in-Histogram.ts => 0084-largest-rectangle-in-histogram.ts} (100%) rename typescript/{90-Subsets-II.ts => 0090-subsets-ii.ts} (100%) rename typescript/{91-Decode-Ways.ts => 0091-decode-ways.ts} (100%) rename typescript/{94-Binary-Tree-Inorder-Traversal.ts => 0094-binary-tree-inorder-traversal.ts} (100%) rename typescript/{97-Interleaving-String.ts => 0097-interleaving-string.ts} (100%) rename typescript/{98-Validate-Binary-Search-Tree.ts => 0098-validate-binary-search-tree.ts} (100%) rename typescript/{100-Same-Tree.ts => 0100-same-tree.ts} (100%) rename typescript/{102-Binary-Tree-Level-Order-Traversal.ts => 0102-binary-tree-level-order-traversal.ts} (100%) rename typescript/{104-Maximum-Depth-of-Binary-Tree.ts => 0104-maximum-depth-of-binary-tree.ts} (100%) rename typescript/{105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.ts => 0105-construct-binary-tree-from-preorder-and-inorder-traversal.ts} (100%) rename typescript/{110-Balanced-Binary-Tree.ts => 0110-balanced-binary-tree.ts} (100%) rename typescript/{115-Distinct-Subsequences.ts => 0115-distinct-subsequences.ts} (100%) rename typescript/{118-Pascal-Triangle.ts => 0118-pascals-triangle.ts} (100%) rename typescript/{121-Best-Time-To-Buy-and-Sell-Stock.ts => 0121-best-time-to-buy-and-sell-stock.ts} (100%) rename typescript/{124-Binary-Tree-Maximum-Path-Sum.ts => 0124-binary-tree-maximum-path-sum.ts} (100%) rename typescript/{125-Valid-Palindrome.ts => 0125-valid-palindrome.ts} (100%) rename typescript/{127-Word-Ladder.ts => 0127-word-ladder.ts} (100%) rename typescript/{128-Longest-Consecutive-Sequence.ts => 0128-longest-consecutive-sequence.ts} (100%) rename typescript/{130-Surrounded-Regions.ts => 0130-surrounded-regions.ts} (100%) rename typescript/{131-Palindrome-Partitioning.ts => 0131-palindrome-partitioning.ts} (100%) rename typescript/{133-Clone-Graph.ts => 0133-clone-graph.ts} (100%) rename typescript/{134-Gas-Station.ts => 0134-gas-station.ts} (100%) rename typescript/{136-Single-Number.ts => 0136-single-number.ts} (100%) rename typescript/{138-Copy-List-with-Random-Pointer.ts => 0138-copy-list-with-random-pointer.ts} (100%) rename typescript/{139-Word-Break.ts => 0139-word-break.ts} (100%) rename typescript/{141-Linked-List-Cycle.ts => 0141-linked-list-cycle.ts} (100%) rename typescript/{143-Reorder-List.ts => 0143-reorder-list.ts} (100%) rename typescript/{150-Evaluate-Reverse-Polish-Notation.ts => 0150-evaluate-reverse-polish-notation.ts} (100%) rename typescript/{152-Maximum-Product-Subarray.ts => 0152-maximum-product-subarray.ts} (100%) rename typescript/{153-Find-Minimum-in-Rotated-Sorted-Array.ts => 0153-find-minimum-in-rotated-sorted-array.ts} (100%) rename typescript/{155-Min-Stack.ts => 0155-min-stack.ts} (100%) rename typescript/{167-Two-Sum-II.ts => 0167-two-sum-ii-input-array-is-sorted.ts} (100%) rename typescript/{169-Majority-Element.ts => 0169-majority-element.ts} (100%) rename typescript/{179-Largest-Number.ts => 0179-largest-number.ts} (100%) rename typescript/{190-Reverse-Bits.ts => 0190-reverse-bits.ts} (100%) rename typescript/{191-Number-of-1-Bits.ts => 0191-number-of-1-bits.ts} (100%) rename typescript/{198-House-Robber.ts => 0198-house-robber.ts} (100%) rename typescript/{199-Binary-Tree-Right-Side-View.ts => 0199-binary-tree-right-side-view.ts} (100%) rename typescript/{200-Number-of-Islands.ts => 0200-number-of-islands.ts} (100%) rename typescript/{202-Happy-Number.ts => 0202-happy-number.ts} (100%) rename typescript/{203-Remove-Linked-List-Elements.ts => 0203-remove-linked-list-elements.ts} (100%) rename typescript/{205-Isomorphic-Strings.ts => 0205-isomorphic-strings.ts} (100%) rename typescript/{206-Reverse-Linked-List.ts => 0206-reverse-linked-list.ts} (100%) rename typescript/{207-Course-Schedule.ts => 0207-course-schedule.ts} (100%) rename typescript/{208-Implement-Trie.ts => 0208-implement-trie-prefix-tree.ts} (100%) rename typescript/{210-Course-Schedule-II.ts => 0210-course-schedule-ii.ts} (100%) rename typescript/{211-Design-Add-and-Search-Words-Data-Structure.ts => 0211-design-add-and-search-words-data-structure.ts} (100%) rename typescript/{213-House-Robber-II.ts => 0213-house-robber-ii.ts} (100%) rename typescript/{215-Kth-Largest-Element-in-an-Array.ts => 0215-kth-largest-element-in-an-array.ts} (100%) rename typescript/{217-Contains-Duplicate.ts => 0217-contains-duplicate.ts} (100%) rename typescript/{226-Invert-Binary-Tree.ts => 0226-invert-binary-tree.ts} (100%) rename typescript/{230-Kth-Smallest-Element-In-A-BST.ts => 0230-kth-smallest-element-in-a-bst.ts} (100%) rename typescript/{235-Lowest-Common-Ancestor-of-a-Binary Search-Tree.ts => 0235-lowest-common-ancestor-of-a-binary-search-tree.ts} (100%) rename typescript/{238-Product-of-Array-Except-Self.ts => 0238-product-of-array-except-self.ts} (100%) rename typescript/{242-Valid-Anagram.ts => 0242-valid-anagram.ts} (100%) rename typescript/{261-Graph-Valid-Tree.ts => 0261-graph-valid-tree.ts} (100%) rename typescript/{268-Missing-Number.ts => 0268-missing-number.ts} (100%) rename typescript/{287-Find-the-Duplicate-Number.ts => 0287-find-the-duplicate-number.ts} (100%) rename typescript/{290-Word-Pattern.ts => 0290-word-pattern.ts} (100%) rename typescript/{300-Longest-Increasing-Subsequence.ts => 0300-longest-increasing-subsequence.ts} (100%) rename typescript/{309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.ts => 0309-best-time-to-buy-and-sell-stock-with-cooldown.ts} (100%) rename typescript/{312-Burst-Balloons.ts => 0312-burst-balloons.ts} (100%) rename typescript/{322-Coin-Change.ts => 0322-coin-change.ts} (100%) rename typescript/{338-Counting-Bits.ts => 0338-counting-bits.ts} (100%) rename typescript/{344-Reverse-String.ts => 0344-reverse-string.ts} (100%) rename typescript/{347-Top-K-Frequent-Elements.ts => 0347-top-k-frequent-elements.ts} (100%) rename typescript/{371-Sum-Of-Two-Integers.ts => 0371-sum-of-two-integers.ts} (100%) rename typescript/{380-Insert-Delete-GetRandom-O(1).ts => 0380-insert-delete-getrandom-o1.ts} (100%) rename typescript/{392-Is-Subsequence.ts => 0392-is-subsequence.ts} (100%) rename typescript/{424-Longest-Repeating-Character-Replacement.ts => 0424-longest-repeating-character-replacement.ts} (100%) rename typescript/{435-Non-overlapping-Intervals.ts => 0435-non-overlapping-intervals.ts} (100%) rename typescript/{494-Target-Sum.ts => 0494-target-sum.ts} (100%) rename typescript/{496-Next-Greater-Element-I.ts => 0496-next-greater-element-i.ts} (100%) rename typescript/{518-Coin-Change-II.ts => 0518-coin-change-ii.ts} (100%) rename typescript/{543-Diameter-of-Binary-Tree.ts => 0543-diameter-of-binary-tree.ts} (100%) rename typescript/{554-Brick-Wall.ts => 0554-brick-wall.ts} (100%) rename typescript/{567-Permutation-in-String.ts => 0567-permutation-in-string.ts} (100%) rename typescript/{572-Subtree-of-Another-Tree.ts => 0572-subtree-of-another-tree.ts} (100%) rename typescript/{605-Can-Place-Flowers.ts => 0605-can-place-flowers.ts} (100%) rename typescript/{621-Task-Scheduler.ts => 0621-task-scheduler.ts} (100%) rename typescript/{647-Palindromic-Substrings.ts => 0647-palindromic-substrings.ts} (100%) rename typescript/{669-Trim-a-Binary-Search-Tree.ts => 0669-trim-a-binary-search-tree.ts} (100%) rename typescript/{678-Valid-Parenthesis-String.ts => 0678-valid-parenthesis-string.ts} (100%) rename typescript/{684-Redundant-Connection.ts => 0684-redundant-connection.ts} (100%) rename typescript/{695-Max-Area-of-Island.ts => 0695-max-area-of-island.ts} (100%) rename typescript/{704-Binary-Search.ts => 0704-binary-search.ts} (100%) rename typescript/{739-Daily-Temperatures.ts => 0739-daily-temperatures.ts} (100%) rename typescript/{746-Min-Cost-Climbing-Stairs.ts => 0746-min-cost-climbing-stairs.ts} (100%) rename typescript/{787-Cheapest-Flights-Within-K-Stops.ts => 0787-cheapest-flights-within-k-stops.ts} (100%) rename typescript/{846-Hand-of-Straights.ts => 0846-hand-of-straights.ts} (100%) rename typescript/{853-Car-Fleet.ts => 0853-car-fleet.ts} (100%) rename typescript/{875-Koko-Eating-Bananas.ts => 0875-koko-eating-bananas.ts} (100%) rename typescript/{929-Unique-Email-Addresses.ts => 0929-unique-email-addresses.ts} (100%) rename typescript/{981-Time-Based-Key-Value-Store.ts => 0981-time-based-key-value-store.ts} (100%) rename typescript/{994-Rotting-Oranges.ts => 0994-rotting-oranges.ts} (100%) create mode 100644 typescript/1046-last-stone-weight.ts create mode 100644 typescript/1143-longest-common-subsequence.ts create mode 100644 typescript/1299-replace-elements-with-greatest-element-on-right-side.ts create mode 100644 typescript/1448-count-good-nodes-in-binary-tree.ts create mode 100644 updateSiteData.js create mode 100644 verifySiteData.js diff --git a/.github/workflows/updateCompletionTable.js b/.github/workflows/updateCompletionTable.js index 3d029154b..8406c81af 100644 --- a/.github/workflows/updateCompletionTable.js +++ b/.github/workflows/updateCompletionTable.js @@ -86,7 +86,7 @@ for (const problemCategory in PROBLEMS_OBJ) { let filePath = nestedFilesInDir[dir].find((file) => file .match(/[\w-]+\..+/)?.[0] - ?.startsWith(problemNumber.toString()) + ?.startsWith(problemNumber) ); if (filePath) { problemRow.push( diff --git a/.problemList.json b/.problemList.json index c2f6b8acc..75ce69a59 100644 --- a/.problemList.json +++ b/.problemList.json @@ -1,1563 +1,1563 @@ { - "Arrays & Hashing": [ - [ - "Contains Duplicate", - "https://leetcode.com/problems/contains-duplicate/", - 217 - ], - [ - "Valid Anagram", - "https://leetcode.com/problems/valid-anagram/", - 242 - ], - [ - "Replace Elements With Greatest Element On Right Side", - "https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/", - 1299 - ], - [ - "Is Subsequence", - "https://leetcode.com/problems/is-subsequence/", - 392 - ], - [ - "Length of Last Word", - "https://leetcode.com/problems/length-of-last-word/", - 58 - ], - [ - "Two Sum", - "https://leetcode.com/problems/two-sum/", - 1 - ], - [ - "Longest Common Prefix", - "https://leetcode.com/problems/longest-common-prefix/", - 14 - ], - [ - "Group Anagrams", - "https://leetcode.com/problems/group-anagrams/", - 49 - ], - [ - "Pascals Triangle", - "https://leetcode.com/problems/pascals-triangle/", - 118 - ], - [ - "Remove Element", - "https://leetcode.com/problems/remove-element/", - 27 - ], - [ - "Unique Email Addresses", - "https://leetcode.com/problems/unique-email-addresses/", - 929 - ], - [ - "Isomorphic Strings", - "https://leetcode.com/problems/isomorphic-strings/", - 205 - ], - [ - "Can Place Flowers", - "https://leetcode.com/problems/can-place-flowers/", - 605 - ], - [ - "Majority Element", - "https://leetcode.com/problems/majority-element/", - 169 - ], - [ - "Next Greater Element I", - "https://leetcode.com/problems/next-greater-element-i/", - 496 - ], - [ - "Find Pivot Index", - "https://leetcode.com/problems/find-pivot-index/", - 724 - ], - [ - "Find All Numbers Disappeared In An Array", - "https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/", - 448 - ], - [ - "Maximum Number of Balloons", - "https://leetcode.com/problems/maximum-number-of-balloons/", - 1189 - ], - [ - "Word Pattern", - "https://leetcode.com/problems/word-pattern/", - 290 - ], - [ - "Top K Frequent Elements", - "https://leetcode.com/problems/top-k-frequent-elements/", - 347 - ], - [ - "Product of Array Except Self", - "https://leetcode.com/problems/product-of-array-except-self/", - 238 - ], - [ - "Valid Sudoku", - "https://leetcode.com/problems/valid-sudoku/", - 36 - ], - [ - "Encode And Decode Strings", - "https://leetcode.com/problems/encode-and-decode-strings/", - 271 - ], - [ - "Longest Consecutive Sequence", - "https://leetcode.com/problems/longest-consecutive-sequence/", - 128 - ], - [ - "Sort Colors", - "https://leetcode.com/problems/sort-colors/", - 75 - ], - [ - "Encode And Decode Tinyurl", - "https://leetcode.com/problems/encode-and-decode-tinyurl/", - 535 - ], - [ - "Brick Wall", - "https://leetcode.com/problems/brick-wall/", - 554 - ], - [ - "Best Time to Buy And Sell Stock II", - "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/", - 122 - ], - [ - "Subarray Sum Equals K", - "https://leetcode.com/problems/subarray-sum-equals-k/", - 560 - ], - [ - "Unique Length 3 Palindromic Subsequences", - "https://leetcode.com/problems/unique-length-3-palindromic-subsequences/", - 1930 - ], - [ - "Minimum Number of Swaps to Make The String Balanced", - "https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/", - 1963 - ], - [ - "Number of Pairs of Interchangeable Rectangles", - "https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles/", - 2001 - ], - [ - "Maximum Product of The Length of Two Palindromic Subsequences", - "https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences/", - 2002 - ], - [ - "Grid Game", - "https://leetcode.com/problems/grid-game/", - 2017 - ], - [ - "Find All Anagrams In a String", - "https://leetcode.com/problems/find-all-anagrams-in-a-string/", - 438 - ], - [ - "Find The Index of The First Occurrence In a String", - "https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/", - 28 - ], - [ - "Wiggle Sort", - "https://leetcode.com/problems/wiggle-sort/", - 280 - ], - [ - "Largest Number", - "https://leetcode.com/problems/largest-number/", - 179 - ], - [ - "Continuous Subarray Sum", - "https://leetcode.com/problems/continuous-subarray-sum/", - 523 - ], - [ - "Push Dominoes", - "https://leetcode.com/problems/push-dominoes/", - 838 - ], - [ - "Repeated Dna Sequences", - "https://leetcode.com/problems/repeated-dna-sequences/", - 187 - ], - [ - "Insert Delete Get Random O(1)", - "https://leetcode.com/problems/insert-delete-getrandom-o1/", - 380 - ], - [ - "Check if a String Contains All Binary Codes of Size K", - "https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/", - 1461 - ], - [ - "Range Sum Query 2D Immutable", - "https://leetcode.com/problems/range-sum-query-2d-immutable/", - 304 - ], - [ - "Non Decreasing Array", - "https://leetcode.com/problems/non-decreasing-array/", - 665 - ], - [ - "First Missing Positive", - "https://leetcode.com/problems/first-missing-positive/", - 41 - ] + "Arrays & Hashing":[ + [ + "Contains Duplicate", + "https://leetcode.com/problems/contains-duplicate/", + "0217" + ], + [ + "Valid Anagram", + "https://leetcode.com/problems/valid-anagram/", + "0242" + ], + [ + "Replace Elements With Greatest Element On Right Side", + "https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/", + "1299" + ], + [ + "Is Subsequence", + "https://leetcode.com/problems/is-subsequence/", + "0392" + ], + [ + "Length of Last Word", + "https://leetcode.com/problems/length-of-last-word/", + "0058" + ], + [ + "Two Sum", + "https://leetcode.com/problems/two-sum/", + "0001" + ], + [ + "Longest Common Prefix", + "https://leetcode.com/problems/longest-common-prefix/", + "0014" + ], + [ + "Group Anagrams", + "https://leetcode.com/problems/group-anagrams/", + "0049" + ], + [ + "Pascals Triangle", + "https://leetcode.com/problems/pascals-triangle/", + "0118" + ], + [ + "Remove Element", + "https://leetcode.com/problems/remove-element/", + "0027" + ], + [ + "Unique Email Addresses", + "https://leetcode.com/problems/unique-email-addresses/", + "0929" + ], + [ + "Isomorphic Strings", + "https://leetcode.com/problems/isomorphic-strings/", + "0205" + ], + [ + "Can Place Flowers", + "https://leetcode.com/problems/can-place-flowers/", + "0605" + ], + [ + "Majority Element", + "https://leetcode.com/problems/majority-element/", + "0169" + ], + [ + "Next Greater Element I", + "https://leetcode.com/problems/next-greater-element-i/", + "0496" + ], + [ + "Find Pivot Index", + "https://leetcode.com/problems/find-pivot-index/", + "0724" + ], + [ + "Find All Numbers Disappeared In An Array", + "https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/", + "0448" + ], + [ + "Maximum Number of Balloons", + "https://leetcode.com/problems/maximum-number-of-balloons/", + "1189" + ], + [ + "Word Pattern", + "https://leetcode.com/problems/word-pattern/", + "0290" + ], + [ + "Top K Frequent Elements", + "https://leetcode.com/problems/top-k-frequent-elements/", + "0347" + ], + [ + "Product of Array Except Self", + "https://leetcode.com/problems/product-of-array-except-self/", + "0238" + ], + [ + "Valid Sudoku", + "https://leetcode.com/problems/valid-sudoku/", + "0036" + ], + [ + "Encode And Decode Strings", + "https://leetcode.com/problems/encode-and-decode-strings/", + "0271" + ], + [ + "Longest Consecutive Sequence", + "https://leetcode.com/problems/longest-consecutive-sequence/", + "0128" + ], + [ + "Sort Colors", + "https://leetcode.com/problems/sort-colors/", + "0075" + ], + [ + "Encode And Decode Tinyurl", + "https://leetcode.com/problems/encode-and-decode-tinyurl/", + "0535" + ], + [ + "Brick Wall", + "https://leetcode.com/problems/brick-wall/", + "0554" + ], + [ + "Best Time to Buy And Sell Stock II", + "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/", + "0122" + ], + [ + "Subarray Sum Equals K", + "https://leetcode.com/problems/subarray-sum-equals-k/", + "0560" + ], + [ + "Unique Length 3 Palindromic Subsequences", + "https://leetcode.com/problems/unique-length-3-palindromic-subsequences/", + "1930" + ], + [ + "Minimum Number of Swaps to Make The String Balanced", + "https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/", + "1963" + ], + [ + "Number of Pairs of Interchangeable Rectangles", + "https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles/", + "2001" + ], + [ + "Maximum Product of The Length of Two Palindromic Subsequences", + "https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences/", + "2002" + ], + [ + "Grid Game", + "https://leetcode.com/problems/grid-game/", + "2017" + ], + [ + "Find All Anagrams In a String", + "https://leetcode.com/problems/find-all-anagrams-in-a-string/", + "0438" + ], + [ + "Find The Index of The First Occurrence In a String", + "https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/", + "0028" + ], + [ + "Wiggle Sort", + "https://leetcode.com/problems/wiggle-sort/", + "0280" + ], + [ + "Largest Number", + "https://leetcode.com/problems/largest-number/", + "0179" + ], + [ + "Continuous Subarray Sum", + "https://leetcode.com/problems/continuous-subarray-sum/", + "0523" + ], + [ + "Push Dominoes", + "https://leetcode.com/problems/push-dominoes/", + "0838" + ], + [ + "Repeated Dna Sequences", + "https://leetcode.com/problems/repeated-dna-sequences/", + "0187" + ], + [ + "Insert Delete Get Random O(1)", + "https://leetcode.com/problems/insert-delete-getrandom-o1/", + "0380" + ], + [ + "Check if a String Contains All Binary Codes of Size K", + "https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/", + "1461" + ], + [ + "Range Sum Query 2D Immutable", + "https://leetcode.com/problems/range-sum-query-2d-immutable/", + "0304" + ], + [ + "Non Decreasing Array", + "https://leetcode.com/problems/non-decreasing-array/", + "0665" + ], + [ + "First Missing Positive", + "https://leetcode.com/problems/first-missing-positive/", + "0041" + ] ], - "Two Pointers": [ - [ - "Valid Palindrome", - "https://leetcode.com/problems/valid-palindrome/", - 125 - ], - [ - "Valid Palindrome II", - "https://leetcode.com/problems/valid-palindrome-ii/", - 680 - ], - [ - "Minimum Difference Between Highest And Lowest of K Scores", - "https://leetcode.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores/", - 1984 - ], - [ - "Reverse String", - "https://leetcode.com/problems/reverse-string/", - 344 - ], - [ - "Merge Sorted Array", - "https://leetcode.com/problems/merge-sorted-array/", - 88 - ], - [ - "Move Zeroes", - "https://leetcode.com/problems/move-zeroes/", - 283 - ], - [ - "Remove Duplicates From Sorted Array", - "https://leetcode.com/problems/remove-duplicates-from-sorted-array/", - 26 - ], - [ - "Two Sum II Input Array Is Sorted", - "https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/", - 167 - ], - [ - "3Sum", - "https://leetcode.com/problems/3sum/", - 15 - ], - [ - "4Sum", - "https://leetcode.com/problems/4sum/", - 18 - ], - [ - "Container With Most Water", - "https://leetcode.com/problems/container-with-most-water/", - 11 - ], - [ - "Number of Subsequences That Satisfy The Given Sum Condition", - "https://leetcode.com/problems/number-of-subsequences-that-satisfy-the-given-sum-condition/", - 1498 - ], - [ - "Rotate Array", - "https://leetcode.com/problems/rotate-array/", - 189 - ], - [ - "Array With Elements Not Equal to Average of Neighbors", - "https://leetcode.com/problems/array-with-elements-not-equal-to-average-of-neighbors/", - 1968 - ], - [ - "Boats to Save People", - "https://leetcode.com/problems/boats-to-save-people/", - 881 - ], - [ - "Trapping Rain Water", - "https://leetcode.com/problems/trapping-rain-water/", - 42 - ] + "Two Pointers":[ + [ + "Valid Palindrome", + "https://leetcode.com/problems/valid-palindrome/", + "0125" + ], + [ + "Valid Palindrome II", + "https://leetcode.com/problems/valid-palindrome-ii/", + "0680" + ], + [ + "Minimum Difference Between Highest And Lowest of K Scores", + "https://leetcode.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores/", + "1984" + ], + [ + "Reverse String", + "https://leetcode.com/problems/reverse-string/", + "0344" + ], + [ + "Merge Sorted Array", + "https://leetcode.com/problems/merge-sorted-array/", + "0088" + ], + [ + "Move Zeroes", + "https://leetcode.com/problems/move-zeroes/", + "0283" + ], + [ + "Remove Duplicates From Sorted Array", + "https://leetcode.com/problems/remove-duplicates-from-sorted-array/", + "0026" + ], + [ + "Two Sum II Input Array Is Sorted", + "https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/", + "0167" + ], + [ + "3Sum", + "https://leetcode.com/problems/3sum/", + "0015" + ], + [ + "4Sum", + "https://leetcode.com/problems/4sum/", + "0018" + ], + [ + "Container With Most Water", + "https://leetcode.com/problems/container-with-most-water/", + "0011" + ], + [ + "Number of Subsequences That Satisfy The Given Sum Condition", + "https://leetcode.com/problems/number-of-subsequences-that-satisfy-the-given-sum-condition/", + "1498" + ], + [ + "Rotate Array", + "https://leetcode.com/problems/rotate-array/", + "0189" + ], + [ + "Array With Elements Not Equal to Average of Neighbors", + "https://leetcode.com/problems/array-with-elements-not-equal-to-average-of-neighbors/", + "1968" + ], + [ + "Boats to Save People", + "https://leetcode.com/problems/boats-to-save-people/", + "0881" + ], + [ + "Trapping Rain Water", + "https://leetcode.com/problems/trapping-rain-water/", + "0042" + ] ], - "Sliding Window": [ - [ - "Best Time to Buy And Sell Stock", - "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", - 121 - ], - [ - "Longest Substring Without Repeating Characters", - "https://leetcode.com/problems/longest-substring-without-repeating-characters/", - 3 - ], - [ - "Longest Repeating Character Replacement", - "https://leetcode.com/problems/longest-repeating-character-replacement/", - 424 - ], - [ - "Permutation In String", - "https://leetcode.com/problems/permutation-in-string/", - 567 - ], - [ - "Frequency of The Most Frequent Element", - "https://leetcode.com/problems/frequency-of-the-most-frequent-element/", - 1838 - ], - [ - "Minimum Number of Flips to Make The Binary String Alternating", - "https://leetcode.com/problems/minimum-number-of-flips-to-make-the-binary-string-alternating/", - 1888 - ], - [ - "Minimum Size Subarray Sum", - "https://leetcode.com/problems/minimum-size-subarray-sum/", - 209 - ], - [ - "Find K Closest Elements", - "https://leetcode.com/problems/find-k-closest-elements/", - 658 - ], - [ - "Minimum Window Substring", - "https://leetcode.com/problems/minimum-window-substring/", - 76 - ], - [ - "Sliding Window Maximum", - "https://leetcode.com/problems/sliding-window-maximum/", - 239 - ] + "Sliding Window":[ + [ + "Best Time to Buy And Sell Stock", + "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", + "0121" + ], + [ + "Longest Substring Without Repeating Characters", + "https://leetcode.com/problems/longest-substring-without-repeating-characters/", + "0003" + ], + [ + "Longest Repeating Character Replacement", + "https://leetcode.com/problems/longest-repeating-character-replacement/", + "0424" + ], + [ + "Permutation In String", + "https://leetcode.com/problems/permutation-in-string/", + "0567" + ], + [ + "Frequency of The Most Frequent Element", + "https://leetcode.com/problems/frequency-of-the-most-frequent-element/", + "1838" + ], + [ + "Minimum Number of Flips to Make The Binary String Alternating", + "https://leetcode.com/problems/minimum-number-of-flips-to-make-the-binary-string-alternating/", + "1888" + ], + [ + "Minimum Size Subarray Sum", + "https://leetcode.com/problems/minimum-size-subarray-sum/", + "0209" + ], + [ + "Find K Closest Elements", + "https://leetcode.com/problems/find-k-closest-elements/", + "0658" + ], + [ + "Minimum Window Substring", + "https://leetcode.com/problems/minimum-window-substring/", + "0076" + ], + [ + "Sliding Window Maximum", + "https://leetcode.com/problems/sliding-window-maximum/", + "0239" + ] ], - "Stack": [ - [ - "Valid Parentheses", - "https://leetcode.com/problems/valid-parentheses/", - 20 - ], - [ - "Baseball Game", - "https://leetcode.com/problems/baseball-game/", - 682 - ], - [ - "Implement Stack Using Queues", - "https://leetcode.com/problems/implement-stack-using-queues/", - 225 - ], - [ - "Min Stack", - "https://leetcode.com/problems/min-stack/", - 155 - ], - [ - "Evaluate Reverse Polish Notation", - "https://leetcode.com/problems/evaluate-reverse-polish-notation/", - 150 - ], - [ - "Generate Parentheses", - "https://leetcode.com/problems/generate-parentheses/", - 22 - ], - [ - "Asteroid Collision", - "https://leetcode.com/problems/asteroid-collision/", - 735 - ], - [ - "Daily Temperatures", - "https://leetcode.com/problems/daily-temperatures/", - 739 - ], - [ - "Online Stock Span", - "https://leetcode.com/problems/online-stock-span/", - 901 - ], - [ - "Car Fleet", - "https://leetcode.com/problems/car-fleet/", - 853 - ], - [ - "Simplify Path", - "https://leetcode.com/problems/simplify-path/", - 71 - ], - [ - "Decode String", - "https://leetcode.com/problems/decode-string/", - 394 - ], - [ - "Remove K Digits", - "https://leetcode.com/problems/remove-k-digits/", - 402 - ], - [ - "Remove All Adjacent Duplicates In String II", - "https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii/", - 1209 - ], - [ - "132 Pattern", - "https://leetcode.com/problems/132-pattern/", - 132 - ], - [ - "Maximum Frequency Stack", - "https://leetcode.com/problems/maximum-frequency-stack/", - 895 - ], - [ - "Largest Rectangle In Histogram", - "https://leetcode.com/problems/largest-rectangle-in-histogram/", - 84 - ] + "Stack":[ + [ + "Valid Parentheses", + "https://leetcode.com/problems/valid-parentheses/", + "0020" + ], + [ + "Baseball Game", + "https://leetcode.com/problems/baseball-game/", + "0682" + ], + [ + "Implement Stack Using Queues", + "https://leetcode.com/problems/implement-stack-using-queues/", + "0225" + ], + [ + "Min Stack", + "https://leetcode.com/problems/min-stack/", + "0155" + ], + [ + "Evaluate Reverse Polish Notation", + "https://leetcode.com/problems/evaluate-reverse-polish-notation/", + "0150" + ], + [ + "Generate Parentheses", + "https://leetcode.com/problems/generate-parentheses/", + "0022" + ], + [ + "Asteroid Collision", + "https://leetcode.com/problems/asteroid-collision/", + "0735" + ], + [ + "Daily Temperatures", + "https://leetcode.com/problems/daily-temperatures/", + "0739" + ], + [ + "Online Stock Span", + "https://leetcode.com/problems/online-stock-span/", + "0901" + ], + [ + "Car Fleet", + "https://leetcode.com/problems/car-fleet/", + "0853" + ], + [ + "Simplify Path", + "https://leetcode.com/problems/simplify-path/", + "0071" + ], + [ + "Decode String", + "https://leetcode.com/problems/decode-string/", + "0394" + ], + [ + "Remove K Digits", + "https://leetcode.com/problems/remove-k-digits/", + "0402" + ], + [ + "Remove All Adjacent Duplicates In String II", + "https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii/", + "1209" + ], + [ + "132 Pattern", + "https://leetcode.com/problems/132-pattern/", + "0132" + ], + [ + "Maximum Frequency Stack", + "https://leetcode.com/problems/maximum-frequency-stack/", + "0895" + ], + [ + "Largest Rectangle In Histogram", + "https://leetcode.com/problems/largest-rectangle-in-histogram/", + "0084" + ] ], - "Binary Search": [ - [ - "Binary Search", - "https://leetcode.com/problems/binary-search/", - 704 - ], - [ - "Search Insert Position", - "https://leetcode.com/problems/search-insert-position/", - 35 - ], - [ - "Guess Number Higher Or Lower", - "https://leetcode.com/problems/guess-number-higher-or-lower/", - 374 - ], - [ - "Arranging Coins", - "https://leetcode.com/problems/arranging-coins/", - 441 - ], - [ - "Squares of a Sorted Array", - "https://leetcode.com/problems/squares-of-a-sorted-array/", - 977 - ], - [ - "Valid Perfect Square", - "https://leetcode.com/problems/valid-perfect-square/", - 367 - ], - [ - "Search a 2D Matrix", - "https://leetcode.com/problems/search-a-2d-matrix/", - 74 - ], - [ - "Koko Eating Bananas", - "https://leetcode.com/problems/koko-eating-bananas/", - 875 - ], - [ - "Search In Rotated Sorted Array", - "https://leetcode.com/problems/search-in-rotated-sorted-array/", - 33 - ], - [ - "Find Minimum In Rotated Sorted Array", - "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", - 153 - ], - [ - "Time Based Key Value Store", - "https://leetcode.com/problems/time-based-key-value-store/", - 981 - ], - [ - "Find First And Last Position of Element In Sorted Array", - "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", - 34 - ], - [ - "Maximum Number of Removable Characters", - "https://leetcode.com/problems/maximum-number-of-removable-characters/", - 1898 - ], - [ - "Populating Next Right Pointers In Each Node", - "https://leetcode.com/problems/populating-next-right-pointers-in-each-node/", - 116 - ], - [ - "Search Suggestions System", - "https://leetcode.com/problems/search-suggestions-system/", - 1268 - ], - [ - "Split Array Largest Sum", - "https://leetcode.com/problems/split-array-largest-sum/", - 410 - ], - [ - "Median of Two Sorted Arrays", - "https://leetcode.com/problems/median-of-two-sorted-arrays/", - 4 - ] + "Binary Search":[ + [ + "Binary Search", + "https://leetcode.com/problems/binary-search/", + "0704" + ], + [ + "Search Insert Position", + "https://leetcode.com/problems/search-insert-position/", + "0035" + ], + [ + "Guess Number Higher Or Lower", + "https://leetcode.com/problems/guess-number-higher-or-lower/", + "0374" + ], + [ + "Arranging Coins", + "https://leetcode.com/problems/arranging-coins/", + "0441" + ], + [ + "Squares of a Sorted Array", + "https://leetcode.com/problems/squares-of-a-sorted-array/", + "0977" + ], + [ + "Valid Perfect Square", + "https://leetcode.com/problems/valid-perfect-square/", + "0367" + ], + [ + "Search a 2D Matrix", + "https://leetcode.com/problems/search-a-2d-matrix/", + "0074" + ], + [ + "Koko Eating Bananas", + "https://leetcode.com/problems/koko-eating-bananas/", + "0875" + ], + [ + "Search In Rotated Sorted Array", + "https://leetcode.com/problems/search-in-rotated-sorted-array/", + "0033" + ], + [ + "Find Minimum In Rotated Sorted Array", + "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", + "0153" + ], + [ + "Time Based Key Value Store", + "https://leetcode.com/problems/time-based-key-value-store/", + "0981" + ], + [ + "Find First And Last Position of Element In Sorted Array", + "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", + "0034" + ], + [ + "Maximum Number of Removable Characters", + "https://leetcode.com/problems/maximum-number-of-removable-characters/", + "1898" + ], + [ + "Populating Next Right Pointers In Each Node", + "https://leetcode.com/problems/populating-next-right-pointers-in-each-node/", + "0116" + ], + [ + "Search Suggestions System", + "https://leetcode.com/problems/search-suggestions-system/", + "1268" + ], + [ + "Split Array Largest Sum", + "https://leetcode.com/problems/split-array-largest-sum/", + "0410" + ], + [ + "Median of Two Sorted Arrays", + "https://leetcode.com/problems/median-of-two-sorted-arrays/", + "0004" + ] ], - "Linked List": [ - [ - "Reverse Linked List", - "https://leetcode.com/problems/reverse-linked-list/", - 206 - ], - [ - "Merge Two Sorted Lists", - "https://leetcode.com/problems/merge-two-sorted-lists/", - 21 - ], - [ - "Palindrome Linked List", - "https://leetcode.com/problems/palindrome-linked-list/", - 234 - ], - [ - "Remove Linked List Elements", - "https://leetcode.com/problems/remove-linked-list-elements/", - 203 - ], - [ - "Remove Duplicates From Sorted List", - "https://leetcode.com/problems/remove-duplicates-from-sorted-list/", - 83 - ], - [ - "Intersection of Two Linked Lists", - "https://leetcode.com/problems/intersection-of-two-linked-lists/", - 160 - ], - [ - "Reorder List", - "https://leetcode.com/problems/reorder-list/", - 143 - ], - [ - "Remove Nth Node From End of List", - "https://leetcode.com/problems/remove-nth-node-from-end-of-list/", - 19 - ], - [ - "Copy List With Random Pointer", - "https://leetcode.com/problems/copy-list-with-random-pointer/", - 138 - ], - [ - "Add Two Numbers", - "https://leetcode.com/problems/add-two-numbers/", - 2 - ], - [ - "Linked List Cycle", - "https://leetcode.com/problems/linked-list-cycle/", - 141 - ], - [ - "Find The Duplicate Number", - "https://leetcode.com/problems/find-the-duplicate-number/", - 287 - ], - [ - "Swap Nodes In Pairs", - "https://leetcode.com/problems/swap-nodes-in-pairs/", - 24 - ], - [ - "Sort List", - "https://leetcode.com/problems/sort-list/", - 148 - ], - [ - "Partition List", - "https://leetcode.com/problems/partition-list/", - 86 - ], - [ - "Rotate List", - "https://leetcode.com/problems/rotate-list/", - 61 - ], - [ - "Reverse Linked List II", - "https://leetcode.com/problems/reverse-linked-list-ii/", - 92 - ], - [ - "Design Circular Queue", - "https://leetcode.com/problems/design-circular-queue/", - 622 - ], - [ - "Insertion Sort List", - "https://leetcode.com/problems/insertion-sort-list/", - 147 - ], - [ - "LRU Cache", - "https://leetcode.com/problems/lru-cache/", - 146 - ], - [ - "Merge K Sorted Lists", - "https://leetcode.com/problems/merge-k-sorted-lists/", - 23 - ], - [ - "Reverse Nodes In K Group", - "https://leetcode.com/problems/reverse-nodes-in-k-group/", - 25 - ] + "Linked List":[ + [ + "Reverse Linked List", + "https://leetcode.com/problems/reverse-linked-list/", + "0206" + ], + [ + "Merge Two Sorted Lists", + "https://leetcode.com/problems/merge-two-sorted-lists/", + "0021" + ], + [ + "Palindrome Linked List", + "https://leetcode.com/problems/palindrome-linked-list/", + "0234" + ], + [ + "Remove Linked List Elements", + "https://leetcode.com/problems/remove-linked-list-elements/", + "0203" + ], + [ + "Remove Duplicates From Sorted List", + "https://leetcode.com/problems/remove-duplicates-from-sorted-list/", + "0083" + ], + [ + "Intersection of Two Linked Lists", + "https://leetcode.com/problems/intersection-of-two-linked-lists/", + "0160" + ], + [ + "Reorder List", + "https://leetcode.com/problems/reorder-list/", + "0143" + ], + [ + "Remove Nth Node From End of List", + "https://leetcode.com/problems/remove-nth-node-from-end-of-list/", + "0019" + ], + [ + "Copy List With Random Pointer", + "https://leetcode.com/problems/copy-list-with-random-pointer/", + "0138" + ], + [ + "Add Two Numbers", + "https://leetcode.com/problems/add-two-numbers/", + "0002" + ], + [ + "Linked List Cycle", + "https://leetcode.com/problems/linked-list-cycle/", + "0141" + ], + [ + "Find The Duplicate Number", + "https://leetcode.com/problems/find-the-duplicate-number/", + "0287" + ], + [ + "Swap Nodes In Pairs", + "https://leetcode.com/problems/swap-nodes-in-pairs/", + "0024" + ], + [ + "Sort List", + "https://leetcode.com/problems/sort-list/", + "0148" + ], + [ + "Partition List", + "https://leetcode.com/problems/partition-list/", + "0086" + ], + [ + "Rotate List", + "https://leetcode.com/problems/rotate-list/", + "0061" + ], + [ + "Reverse Linked List II", + "https://leetcode.com/problems/reverse-linked-list-ii/", + "0092" + ], + [ + "Design Circular Queue", + "https://leetcode.com/problems/design-circular-queue/", + "0622" + ], + [ + "Insertion Sort List", + "https://leetcode.com/problems/insertion-sort-list/", + "0147" + ], + [ + "LRU Cache", + "https://leetcode.com/problems/lru-cache/", + "0146" + ], + [ + "Merge K Sorted Lists", + "https://leetcode.com/problems/merge-k-sorted-lists/", + "0023" + ], + [ + "Reverse Nodes In K Group", + "https://leetcode.com/problems/reverse-nodes-in-k-group/", + "0025" + ] ], - "Trees": [ - [ - "Binary Tree Inorder Traversal", - "https://leetcode.com/problems/binary-tree-inorder-traversal/", - 94 - ], - [ - "Invert Binary Tree", - "https://leetcode.com/problems/invert-binary-tree/", - 226 - ], - [ - "Maximum Depth of Binary Tree", - "https://leetcode.com/problems/maximum-depth-of-binary-tree/", - 104 - ], - [ - "Diameter of Binary Tree", - "https://leetcode.com/problems/diameter-of-binary-tree/", - 543 - ], - [ - "Balanced Binary Tree", - "https://leetcode.com/problems/balanced-binary-tree/", - 110 - ], - [ - "Same Tree", - "https://leetcode.com/problems/same-tree/", - 100 - ], - [ - "Subtree of Another Tree", - "https://leetcode.com/problems/subtree-of-another-tree/", - 572 - ], - [ - "Convert Sorted Array to Binary Search Tree", - "https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/", - 108 - ], - [ - "Merge Two Binary Trees", - "https://leetcode.com/problems/merge-two-binary-trees/", - 617 - ], - [ - "Path Sum", - "https://leetcode.com/problems/path-sum/", - 112 - ], - [ - "Construct String From Binary Tree", - "https://leetcode.com/problems/construct-string-from-binary-tree/", - 606 - ], - [ - "Lowest Common Ancestor of a Binary Search Tree", - "https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/", - 235 - ], - [ - "Binary Tree Level Order Traversal", - "https://leetcode.com/problems/binary-tree-level-order-traversal/", - 102 - ], - [ - "Binary Tree Right Side View", - "https://leetcode.com/problems/binary-tree-right-side-view/", - 199 - ], - [ - "Count Good Nodes In Binary Tree", - "https://leetcode.com/problems/count-good-nodes-in-binary-tree/", - 1448 - ], - [ - "Validate Binary Search Tree", - "https://leetcode.com/problems/validate-binary-search-tree/", - 98 - ], - [ - "Kth Smallest Element In a Bst", - "https://leetcode.com/problems/kth-smallest-element-in-a-bst/", - 230 - ], - [ - "Construct Binary Tree From Preorder And Inorder Traversal", - "https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/", - 105 - ], - [ - "Unique Binary Search Trees", - "https://leetcode.com/problems/unique-binary-search-trees/", - 96 - ], - [ - "Sum Root to Leaf Numbers", - "https://leetcode.com/problems/sum-root-to-leaf-numbers/", - 129 - ], - [ - "House Robber III", - "https://leetcode.com/problems/house-robber-iii/", - 337 - ], - [ - "Flip Equivalent Binary Trees", - "https://leetcode.com/problems/flip-equivalent-binary-trees/", - 951 - ], - [ - "Operations On Tree", - "https://leetcode.com/problems/operations-on-tree/", - 1993 - ], - [ - "All Possible Full Binary Trees", - "https://leetcode.com/problems/all-possible-full-binary-trees/", - 894 - ], - [ - "Find Bottom Left Tree Value", - "https://leetcode.com/problems/find-bottom-left-tree-value/", - 513 - ], - [ - "Trim a Binary Search Tree", - "https://leetcode.com/problems/trim-a-binary-search-tree/", - 669 - ], - [ - "Binary Search Tree Iterator", - "https://leetcode.com/problems/binary-search-tree-iterator/", - 173 - ], - [ - "Convert Bst to Greater Tree", - "https://leetcode.com/problems/convert-bst-to-greater-tree/", - 538 - ], - [ - "Binary Tree Maximum Path Sum", - "https://leetcode.com/problems/binary-tree-maximum-path-sum/", - 124 - ], - [ - "Serialize And Deserialize Binary Tree", - "https://leetcode.com/problems/serialize-and-deserialize-binary-tree/", - 297 - ] + "Trees":[ + [ + "Binary Tree Inorder Traversal", + "https://leetcode.com/problems/binary-tree-inorder-traversal/", + "0094" + ], + [ + "Invert Binary Tree", + "https://leetcode.com/problems/invert-binary-tree/", + "0226" + ], + [ + "Maximum Depth of Binary Tree", + "https://leetcode.com/problems/maximum-depth-of-binary-tree/", + "0104" + ], + [ + "Diameter of Binary Tree", + "https://leetcode.com/problems/diameter-of-binary-tree/", + "0543" + ], + [ + "Balanced Binary Tree", + "https://leetcode.com/problems/balanced-binary-tree/", + "0110" + ], + [ + "Same Tree", + "https://leetcode.com/problems/same-tree/", + "0100" + ], + [ + "Subtree of Another Tree", + "https://leetcode.com/problems/subtree-of-another-tree/", + "0572" + ], + [ + "Convert Sorted Array to Binary Search Tree", + "https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/", + "0108" + ], + [ + "Merge Two Binary Trees", + "https://leetcode.com/problems/merge-two-binary-trees/", + "0617" + ], + [ + "Path Sum", + "https://leetcode.com/problems/path-sum/", + "0112" + ], + [ + "Construct String From Binary Tree", + "https://leetcode.com/problems/construct-string-from-binary-tree/", + "0606" + ], + [ + "Lowest Common Ancestor of a Binary Search Tree", + "https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/", + "0235" + ], + [ + "Binary Tree Level Order Traversal", + "https://leetcode.com/problems/binary-tree-level-order-traversal/", + "0102" + ], + [ + "Binary Tree Right Side View", + "https://leetcode.com/problems/binary-tree-right-side-view/", + "0199" + ], + [ + "Count Good Nodes In Binary Tree", + "https://leetcode.com/problems/count-good-nodes-in-binary-tree/", + "1448" + ], + [ + "Validate Binary Search Tree", + "https://leetcode.com/problems/validate-binary-search-tree/", + "0098" + ], + [ + "Kth Smallest Element In a Bst", + "https://leetcode.com/problems/kth-smallest-element-in-a-bst/", + "0230" + ], + [ + "Construct Binary Tree From Preorder And Inorder Traversal", + "https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/", + "0105" + ], + [ + "Unique Binary Search Trees", + "https://leetcode.com/problems/unique-binary-search-trees/", + "0096" + ], + [ + "Sum Root to Leaf Numbers", + "https://leetcode.com/problems/sum-root-to-leaf-numbers/", + "0129" + ], + [ + "House Robber III", + "https://leetcode.com/problems/house-robber-iii/", + "0337" + ], + [ + "Flip Equivalent Binary Trees", + "https://leetcode.com/problems/flip-equivalent-binary-trees/", + "0951" + ], + [ + "Operations On Tree", + "https://leetcode.com/problems/operations-on-tree/", + "1993" + ], + [ + "All Possible Full Binary Trees", + "https://leetcode.com/problems/all-possible-full-binary-trees/", + "0894" + ], + [ + "Find Bottom Left Tree Value", + "https://leetcode.com/problems/find-bottom-left-tree-value/", + "0513" + ], + [ + "Trim a Binary Search Tree", + "https://leetcode.com/problems/trim-a-binary-search-tree/", + "0669" + ], + [ + "Binary Search Tree Iterator", + "https://leetcode.com/problems/binary-search-tree-iterator/", + "0173" + ], + [ + "Convert Bst to Greater Tree", + "https://leetcode.com/problems/convert-bst-to-greater-tree/", + "0538" + ], + [ + "Binary Tree Maximum Path Sum", + "https://leetcode.com/problems/binary-tree-maximum-path-sum/", + "0124" + ], + [ + "Serialize And Deserialize Binary Tree", + "https://leetcode.com/problems/serialize-and-deserialize-binary-tree/", + "0297" + ] ], - "Tries": [ - [ - "Implement Trie Prefix Tree", - "https://leetcode.com/problems/implement-trie-prefix-tree/", - 208 - ], - [ - "Design Add And Search Words Data Structure", - "https://leetcode.com/problems/design-add-and-search-words-data-structure/", - 211 - ], - [ - "Word Search II", - "https://leetcode.com/problems/word-search-ii/", - 212 - ] + "Tries":[ + [ + "Implement Trie Prefix Tree", + "https://leetcode.com/problems/implement-trie-prefix-tree/", + "0208" + ], + [ + "Design Add And Search Words Data Structure", + "https://leetcode.com/problems/design-add-and-search-words-data-structure/", + "0211" + ], + [ + "Word Search II", + "https://leetcode.com/problems/word-search-ii/", + "0212" + ] ], - "Heap / Priority Queue": [ - [ - "Kth Largest Element In a Stream", - "https://leetcode.com/problems/kth-largest-element-in-a-stream/", - 703 - ], - [ - "Last Stone Weight", - "https://leetcode.com/problems/last-stone-weight/", - 1046 - ], - [ - "K Closest Points to Origin", - "https://leetcode.com/problems/k-closest-points-to-origin/", - 973 - ], - [ - "Kth Largest Element In An Array", - "https://leetcode.com/problems/kth-largest-element-in-an-array/", - 215 - ], - [ - "Task Scheduler", - "https://leetcode.com/problems/task-scheduler/", - 621 - ], - [ - "Design Twitter", - "https://leetcode.com/problems/design-twitter/", - 355 - ], - [ - "Single Threaded Cpu", - "https://leetcode.com/problems/single-threaded-cpu/", - 1834 - ], - [ - "Seat Reservation Manager", - "https://leetcode.com/problems/seat-reservation-manager/", - 1845 - ], - [ - "Process Tasks Using Servers", - "https://leetcode.com/problems/process-tasks-using-servers/", - 1882 - ], - [ - "Find The Kth Largest Integer In The Array", - "https://leetcode.com/problems/find-the-kth-largest-integer-in-the-array/", - 1985 - ], - [ - "Reorganize String", - "https://leetcode.com/problems/reorganize-string/", - 767 - ], - [ - "Longest Happy String", - "https://leetcode.com/problems/longest-happy-string/", - 1405 - ], - [ - "Car Pooling", - "https://leetcode.com/problems/car-pooling/", - 1094 - ], - [ - "Find Median From Data Stream", - "https://leetcode.com/problems/find-median-from-data-stream/", - 295 - ], - [ - "Maximum Performance of a Team", - "https://leetcode.com/problems/maximum-performance-of-a-team/", - 1383 - ] + "Heap / Priority Queue":[ + [ + "Kth Largest Element In a Stream", + "https://leetcode.com/problems/kth-largest-element-in-a-stream/", + "0703" + ], + [ + "Last Stone Weight", + "https://leetcode.com/problems/last-stone-weight/", + "1046" + ], + [ + "K Closest Points to Origin", + "https://leetcode.com/problems/k-closest-points-to-origin/", + "0973" + ], + [ + "Kth Largest Element In An Array", + "https://leetcode.com/problems/kth-largest-element-in-an-array/", + "0215" + ], + [ + "Task Scheduler", + "https://leetcode.com/problems/task-scheduler/", + "0621" + ], + [ + "Design Twitter", + "https://leetcode.com/problems/design-twitter/", + "0355" + ], + [ + "Single Threaded Cpu", + "https://leetcode.com/problems/single-threaded-cpu/", + "1834" + ], + [ + "Seat Reservation Manager", + "https://leetcode.com/problems/seat-reservation-manager/", + "1845" + ], + [ + "Process Tasks Using Servers", + "https://leetcode.com/problems/process-tasks-using-servers/", + "1882" + ], + [ + "Find The Kth Largest Integer In The Array", + "https://leetcode.com/problems/find-the-kth-largest-integer-in-the-array/", + "1985" + ], + [ + "Reorganize String", + "https://leetcode.com/problems/reorganize-string/", + "0767" + ], + [ + "Longest Happy String", + "https://leetcode.com/problems/longest-happy-string/", + "1405" + ], + [ + "Car Pooling", + "https://leetcode.com/problems/car-pooling/", + "1094" + ], + [ + "Find Median From Data Stream", + "https://leetcode.com/problems/find-median-from-data-stream/", + "0295" + ], + [ + "Maximum Performance of a Team", + "https://leetcode.com/problems/maximum-performance-of-a-team/", + "1383" + ] ], - "Backtracking": [ - [ - "Subsets", - "https://leetcode.com/problems/subsets/", - 78 - ], - [ - "Combination Sum", - "https://leetcode.com/problems/combination-sum/", - 39 - ], - [ - "Combinations", - "https://leetcode.com/problems/combinations/", - 77 - ], - [ - "Permutations", - "https://leetcode.com/problems/permutations/", - 46 - ], - [ - "Subsets II", - "https://leetcode.com/problems/subsets-ii/", - 90 - ], - [ - "Combination Sum II", - "https://leetcode.com/problems/combination-sum-ii/", - 40 - ], - [ - "Permutations II", - "https://leetcode.com/problems/permutations-ii/", - 47 - ], - [ - "Word Search", - "https://leetcode.com/problems/word-search/", - 79 - ], - [ - "Palindrome Partitioning", - "https://leetcode.com/problems/palindrome-partitioning/", - 131 - ], - [ - "Restore Ip Addresses", - "https://leetcode.com/problems/restore-ip-addresses/", - 93 - ], - [ - "Letter Combinations of a Phone Number", - "https://leetcode.com/problems/letter-combinations-of-a-phone-number/", - 17 - ], - [ - "Matchsticks to Square", - "https://leetcode.com/problems/matchsticks-to-square/", - 473 - ], - [ - "Splitting a String Into Descending Consecutive Values", - "https://leetcode.com/problems/splitting-a-string-into-descending-consecutive-values/", - 1849 - ], - [ - "Find Unique Binary String", - "https://leetcode.com/problems/find-unique-binary-string/", - 1980 - ], - [ - "Maximum Length of a Concatenated String With Unique Characters", - "https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/", - 1239 - ], - [ - "Partition to K Equal Sum Subsets", - "https://leetcode.com/problems/partition-to-k-equal-sum-subsets/", - 698 - ], - [ - "N Queens", - "https://leetcode.com/problems/n-queens/", - 51 - ], - [ - "N Queens II", - "https://leetcode.com/problems/n-queens-ii/", - 52 - ] + "Backtracking":[ + [ + "Subsets", + "https://leetcode.com/problems/subsets/", + "0078" + ], + [ + "Combination Sum", + "https://leetcode.com/problems/combination-sum/", + "0039" + ], + [ + "Combinations", + "https://leetcode.com/problems/combinations/", + "0077" + ], + [ + "Permutations", + "https://leetcode.com/problems/permutations/", + "0046" + ], + [ + "Subsets II", + "https://leetcode.com/problems/subsets-ii/", + "0090" + ], + [ + "Combination Sum II", + "https://leetcode.com/problems/combination-sum-ii/", + "0040" + ], + [ + "Permutations II", + "https://leetcode.com/problems/permutations-ii/", + "0047" + ], + [ + "Word Search", + "https://leetcode.com/problems/word-search/", + "0079" + ], + [ + "Palindrome Partitioning", + "https://leetcode.com/problems/palindrome-partitioning/", + "0131" + ], + [ + "Restore Ip Addresses", + "https://leetcode.com/problems/restore-ip-addresses/", + "0093" + ], + [ + "Letter Combinations of a Phone Number", + "https://leetcode.com/problems/letter-combinations-of-a-phone-number/", + "0017" + ], + [ + "Matchsticks to Square", + "https://leetcode.com/problems/matchsticks-to-square/", + "0473" + ], + [ + "Splitting a String Into Descending Consecutive Values", + "https://leetcode.com/problems/splitting-a-string-into-descending-consecutive-values/", + "1849" + ], + [ + "Find Unique Binary String", + "https://leetcode.com/problems/find-unique-binary-string/", + "1980" + ], + [ + "Maximum Length of a Concatenated String With Unique Characters", + "https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/", + "1239" + ], + [ + "Partition to K Equal Sum Subsets", + "https://leetcode.com/problems/partition-to-k-equal-sum-subsets/", + "0698" + ], + [ + "N Queens", + "https://leetcode.com/problems/n-queens/", + "0051" + ], + [ + "N Queens II", + "https://leetcode.com/problems/n-queens-ii/", + "0052" + ] ], - "Graphs": [ - [ - "Island Perimeter", - "https://leetcode.com/problems/island-perimeter/", - 463 - ], - [ - "Verifying An Alien Dictionary", - "https://leetcode.com/problems/verifying-an-alien-dictionary/", - 953 - ], - [ - "Number of Islands", - "https://leetcode.com/problems/number-of-islands/", - 200 - ], - [ - "Clone Graph", - "https://leetcode.com/problems/clone-graph/", - 133 - ], - [ - "Max Area of Island", - "https://leetcode.com/problems/max-area-of-island/", - 695 - ], - [ - "Count Sub Islands", - "https://leetcode.com/problems/count-sub-islands/", - 1905 - ], - [ - "Pacific Atlantic Water Flow", - "https://leetcode.com/problems/pacific-atlantic-water-flow/", - 417 - ], - [ - "Surrounded Regions", - "https://leetcode.com/problems/surrounded-regions/", - 130 - ], - [ - "Reorder Routes to Make All Paths Lead to The City Zero", - "https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/", - 1466 - ], - [ - "Rotting Oranges", - "https://leetcode.com/problems/rotting-oranges/", - 994 - ], - [ - "Walls And Gates", - "https://leetcode.com/problems/walls-and-gates/", - 286 - ], - [ - "Snakes And Ladders", - "https://leetcode.com/problems/snakes-and-ladders/", - 909 - ], - [ - "Open The Lock", - "https://leetcode.com/problems/open-the-lock/", - 752 - ], - [ - "Find Eventual Safe States", - "https://leetcode.com/problems/find-eventual-safe-states/", - 802 - ], - [ - "Course Schedule", - "https://leetcode.com/problems/course-schedule/", - 207 - ], - [ - "Course Schedule II", - "https://leetcode.com/problems/course-schedule-ii/", - 210 - ], - [ - "Check if Move Is Legal", - "https://leetcode.com/problems/check-if-move-is-legal/", - 1958 - ], - [ - "Shortest Bridge", - "https://leetcode.com/problems/shortest-bridge/", - 934 - ], - [ - "Redundant Connection", - "https://leetcode.com/problems/redundant-connection/", - 684 - ], - [ - "Number of Connected Components In An Undirected Graph", - "https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/", - 323 - ], - [ - "Graph Valid Tree", - "https://leetcode.com/problems/graph-valid-tree/", - 261 - ], - [ - "Minimum Number of Days to Eat N Oranges", - "https://leetcode.com/problems/minimum-number-of-days-to-eat-n-oranges/", - 1553 - ], - [ - "Word Ladder", - "https://leetcode.com/problems/word-ladder/", - 127 - ] + "Graphs":[ + [ + "Island Perimeter", + "https://leetcode.com/problems/island-perimeter/", + "0463" + ], + [ + "Verifying An Alien Dictionary", + "https://leetcode.com/problems/verifying-an-alien-dictionary/", + "0953" + ], + [ + "Number of Islands", + "https://leetcode.com/problems/number-of-islands/", + "0200" + ], + [ + "Clone Graph", + "https://leetcode.com/problems/clone-graph/", + "0133" + ], + [ + "Max Area of Island", + "https://leetcode.com/problems/max-area-of-island/", + "0695" + ], + [ + "Count Sub Islands", + "https://leetcode.com/problems/count-sub-islands/", + "1905" + ], + [ + "Pacific Atlantic Water Flow", + "https://leetcode.com/problems/pacific-atlantic-water-flow/", + "0417" + ], + [ + "Surrounded Regions", + "https://leetcode.com/problems/surrounded-regions/", + "0130" + ], + [ + "Reorder Routes to Make All Paths Lead to The City Zero", + "https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/", + "1466" + ], + [ + "Rotting Oranges", + "https://leetcode.com/problems/rotting-oranges/", + "0994" + ], + [ + "Walls And Gates", + "https://leetcode.com/problems/walls-and-gates/", + "0286" + ], + [ + "Snakes And Ladders", + "https://leetcode.com/problems/snakes-and-ladders/", + "0909" + ], + [ + "Open The Lock", + "https://leetcode.com/problems/open-the-lock/", + "0752" + ], + [ + "Find Eventual Safe States", + "https://leetcode.com/problems/find-eventual-safe-states/", + "0802" + ], + [ + "Course Schedule", + "https://leetcode.com/problems/course-schedule/", + "0207" + ], + [ + "Course Schedule II", + "https://leetcode.com/problems/course-schedule-ii/", + "0210" + ], + [ + "Check if Move Is Legal", + "https://leetcode.com/problems/check-if-move-is-legal/", + "1958" + ], + [ + "Shortest Bridge", + "https://leetcode.com/problems/shortest-bridge/", + "0934" + ], + [ + "Redundant Connection", + "https://leetcode.com/problems/redundant-connection/", + "0684" + ], + [ + "Number of Connected Components In An Undirected Graph", + "https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/", + "0323" + ], + [ + "Graph Valid Tree", + "https://leetcode.com/problems/graph-valid-tree/", + "0261" + ], + [ + "Minimum Number of Days to Eat N Oranges", + "https://leetcode.com/problems/minimum-number-of-days-to-eat-n-oranges/", + "1553" + ], + [ + "Word Ladder", + "https://leetcode.com/problems/word-ladder/", + "0127" + ] ], - "Advanced Graphs": [ - [ - "Reconstruct Itinerary", - "https://leetcode.com/problems/reconstruct-itinerary/", - 332 - ], - [ - "Min Cost to Connect All Points", - "https://leetcode.com/problems/min-cost-to-connect-all-points/", - 1584 - ], - [ - "Network Delay Time", - "https://leetcode.com/problems/network-delay-time/", - 743 - ], - [ - "Swim In Rising Water", - "https://leetcode.com/problems/swim-in-rising-water/", - 778 - ], - [ - "Alien Dictionary", - "https://leetcode.com/problems/alien-dictionary/", - 269 - ], - [ - "Cheapest Flights Within K Stops", - "https://leetcode.com/problems/cheapest-flights-within-k-stops/", - 787 - ] + "Advanced Graphs":[ + [ + "Reconstruct Itinerary", + "https://leetcode.com/problems/reconstruct-itinerary/", + "0332" + ], + [ + "Min Cost to Connect All Points", + "https://leetcode.com/problems/min-cost-to-connect-all-points/", + "1584" + ], + [ + "Network Delay Time", + "https://leetcode.com/problems/network-delay-time/", + "0743" + ], + [ + "Swim In Rising Water", + "https://leetcode.com/problems/swim-in-rising-water/", + "0778" + ], + [ + "Alien Dictionary", + "https://leetcode.com/problems/alien-dictionary/", + "0269" + ], + [ + "Cheapest Flights Within K Stops", + "https://leetcode.com/problems/cheapest-flights-within-k-stops/", + "0787" + ] ], - "1-D Dynamic Programming": [ - [ - "Climbing Stairs", - "https://leetcode.com/problems/climbing-stairs/", - 70 - ], - [ - "Min Cost Climbing Stairs", - "https://leetcode.com/problems/min-cost-climbing-stairs/", - 746 - ], - [ - "House Robber", - "https://leetcode.com/problems/house-robber/", - 198 - ], - [ - "House Robber II", - "https://leetcode.com/problems/house-robber-ii/", - 213 - ], - [ - "Longest Palindromic Substring", - "https://leetcode.com/problems/longest-palindromic-substring/", - 5 - ], - [ - "Palindromic Substrings", - "https://leetcode.com/problems/palindromic-substrings/", - 647 - ], - [ - "Decode Ways", - "https://leetcode.com/problems/decode-ways/", - 91 - ], - [ - "Coin Change", - "https://leetcode.com/problems/coin-change/", - 322 - ], - [ - "Maximum Product Subarray", - "https://leetcode.com/problems/maximum-product-subarray/", - 152 - ], - [ - "Word Break", - "https://leetcode.com/problems/word-break/", - 139 - ], - [ - "Longest Increasing Subsequence", - "https://leetcode.com/problems/longest-increasing-subsequence/", - 300 - ], - [ - "Partition Equal Subset Sum", - "https://leetcode.com/problems/partition-equal-subset-sum/", - 416 - ], - [ - "Triangle", - "https://leetcode.com/problems/triangle/", - 120 - ], - [ - "Delete And Earn", - "https://leetcode.com/problems/delete-and-earn/", - 740 - ], - [ - "Paint House", - "https://leetcode.com/problems/paint-house/", - 256 - ], - [ - "Combination Sum IV", - "https://leetcode.com/problems/combination-sum-iv/", - 377 - ], - [ - "Perfect Squares", - "https://leetcode.com/problems/perfect-squares/", - 279 - ], - [ - "Maximum Subarray Min Product", - "https://leetcode.com/problems/maximum-subarray-min-product/", - 1856 - ], - [ - "Minimum Cost For Tickets", - "https://leetcode.com/problems/minimum-cost-for-tickets/", - 983 - ], - [ - "Integer Break", - "https://leetcode.com/problems/integer-break/", - 343 - ], - [ - "Number of Longest Increasing Subsequence", - "https://leetcode.com/problems/number-of-longest-increasing-subsequence/", - 673 - ], - [ - "Stickers to Spell Word", - "https://leetcode.com/problems/stickers-to-spell-word/", - 691 - ] + "1-D Dynamic Programming":[ + [ + "Climbing Stairs", + "https://leetcode.com/problems/climbing-stairs/", + "0070" + ], + [ + "Min Cost Climbing Stairs", + "https://leetcode.com/problems/min-cost-climbing-stairs/", + "0746" + ], + [ + "House Robber", + "https://leetcode.com/problems/house-robber/", + "0198" + ], + [ + "House Robber II", + "https://leetcode.com/problems/house-robber-ii/", + "0213" + ], + [ + "Longest Palindromic Substring", + "https://leetcode.com/problems/longest-palindromic-substring/", + "0005" + ], + [ + "Palindromic Substrings", + "https://leetcode.com/problems/palindromic-substrings/", + "0647" + ], + [ + "Decode Ways", + "https://leetcode.com/problems/decode-ways/", + "0091" + ], + [ + "Coin Change", + "https://leetcode.com/problems/coin-change/", + "0322" + ], + [ + "Maximum Product Subarray", + "https://leetcode.com/problems/maximum-product-subarray/", + "0152" + ], + [ + "Word Break", + "https://leetcode.com/problems/word-break/", + "0139" + ], + [ + "Longest Increasing Subsequence", + "https://leetcode.com/problems/longest-increasing-subsequence/", + "0300" + ], + [ + "Partition Equal Subset Sum", + "https://leetcode.com/problems/partition-equal-subset-sum/", + "0416" + ], + [ + "Triangle", + "https://leetcode.com/problems/triangle/", + "0120" + ], + [ + "Delete And Earn", + "https://leetcode.com/problems/delete-and-earn/", + "0740" + ], + [ + "Paint House", + "https://leetcode.com/problems/paint-house/", + "0256" + ], + [ + "Combination Sum IV", + "https://leetcode.com/problems/combination-sum-iv/", + "0377" + ], + [ + "Perfect Squares", + "https://leetcode.com/problems/perfect-squares/", + "0279" + ], + [ + "Maximum Subarray Min Product", + "https://leetcode.com/problems/maximum-subarray-min-product/", + "1856" + ], + [ + "Minimum Cost For Tickets", + "https://leetcode.com/problems/minimum-cost-for-tickets/", + "0983" + ], + [ + "Integer Break", + "https://leetcode.com/problems/integer-break/", + "0343" + ], + [ + "Number of Longest Increasing Subsequence", + "https://leetcode.com/problems/number-of-longest-increasing-subsequence/", + "0673" + ], + [ + "Stickers to Spell Word", + "https://leetcode.com/problems/stickers-to-spell-word/", + "0691" + ] ], - "2-D Dynamic Programming": [ - [ - "Unique Paths", - "https://leetcode.com/problems/unique-paths/", - 62 - ], - [ - "Longest Common Subsequence", - "https://leetcode.com/problems/longest-common-subsequence/", - 1143 - ], - [ - "Best Time to Buy And Sell Stock With Cooldown", - "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/", - 309 - ], - [ - "Coin Change II", - "https://leetcode.com/problems/coin-change-ii/", - 518 - ], - [ - "Target Sum", - "https://leetcode.com/problems/target-sum/", - 494 - ], - [ - "Interleaving String", - "https://leetcode.com/problems/interleaving-string/", - 97 - ], - [ - "Stone Game", - "https://leetcode.com/problems/stone-game/", - 877 - ], - [ - "Minimum Path Sum", - "https://leetcode.com/problems/minimum-path-sum/", - 64 - ], - [ - "Longest Increasing Path In a Matrix", - "https://leetcode.com/problems/longest-increasing-path-in-a-matrix/", - 329 - ], - [ - "Maximal Square", - "https://leetcode.com/problems/maximal-square/", - 221 - ], - [ - "Maximum Alternating Subsequence Sum", - "https://leetcode.com/problems/maximum-alternating-subsequence-sum/", - 5782 - ], - [ - "Distinct Subsequences", - "https://leetcode.com/problems/distinct-subsequences/", - 115 - ], - [ - "Edit Distance", - "https://leetcode.com/problems/edit-distance/", - 72 - ], - [ - "Count Vowels Permutation", - "https://leetcode.com/problems/count-vowels-permutation/", - 1220 - ], - [ - "Burst Balloons", - "https://leetcode.com/problems/burst-balloons/", - 312 - ], - [ - "Number of Ways to Rearrange Sticks With K Sticks Visible", - "https://leetcode.com/problems/number-of-ways-to-rearrange-sticks-with-k-sticks-visible/", - 1866 - ], - [ - "Regular Expression Matching", - "https://leetcode.com/problems/regular-expression-matching/", - 10 - ] + "2-D Dynamic Programming":[ + [ + "Unique Paths", + "https://leetcode.com/problems/unique-paths/", + "0062" + ], + [ + "Longest Common Subsequence", + "https://leetcode.com/problems/longest-common-subsequence/", + "1143" + ], + [ + "Best Time to Buy And Sell Stock With Cooldown", + "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/", + "0309" + ], + [ + "Coin Change II", + "https://leetcode.com/problems/coin-change-ii/", + "0518" + ], + [ + "Target Sum", + "https://leetcode.com/problems/target-sum/", + "0494" + ], + [ + "Interleaving String", + "https://leetcode.com/problems/interleaving-string/", + "0097" + ], + [ + "Stone Game", + "https://leetcode.com/problems/stone-game/", + "0877" + ], + [ + "Minimum Path Sum", + "https://leetcode.com/problems/minimum-path-sum/", + "0064" + ], + [ + "Longest Increasing Path In a Matrix", + "https://leetcode.com/problems/longest-increasing-path-in-a-matrix/", + "0329" + ], + [ + "Maximal Square", + "https://leetcode.com/problems/maximal-square/", + "0221" + ], + [ + "Maximum Alternating Subsequence Sum", + "https://leetcode.com/problems/maximum-alternating-subsequence-sum/", + "5782" + ], + [ + "Distinct Subsequences", + "https://leetcode.com/problems/distinct-subsequences/", + "0115" + ], + [ + "Edit Distance", + "https://leetcode.com/problems/edit-distance/", + "0072" + ], + [ + "Count Vowels Permutation", + "https://leetcode.com/problems/count-vowels-permutation/", + "1220" + ], + [ + "Burst Balloons", + "https://leetcode.com/problems/burst-balloons/", + "0312" + ], + [ + "Number of Ways to Rearrange Sticks With K Sticks Visible", + "https://leetcode.com/problems/number-of-ways-to-rearrange-sticks-with-k-sticks-visible/", + "1866" + ], + [ + "Regular Expression Matching", + "https://leetcode.com/problems/regular-expression-matching/", + "0010" + ] ], - "Greedy": [ - [ - "Maximum Subarray", - "https://leetcode.com/problems/maximum-subarray/", - 53 - ], - [ - "Jump Game", - "https://leetcode.com/problems/jump-game/", - 55 - ], - [ - "Jump Game II", - "https://leetcode.com/problems/jump-game-ii/", - 45 - ], - [ - "Jump Game VII", - "https://leetcode.com/problems/jump-game-vii/", - 1871 - ], - [ - "Gas Station", - "https://leetcode.com/problems/gas-station/", - 134 - ], - [ - "Hand of Straights", - "https://leetcode.com/problems/hand-of-straights/", - 846 - ], - [ - "Maximum Points You Can Obtain From Cards", - "https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards/", - 1423 - ], - [ - "Merge Triplets to Form Target Triplet", - "https://leetcode.com/problems/merge-triplets-to-form-target-triplet/", - 1898 - ], - [ - "Partition Labels", - "https://leetcode.com/problems/partition-labels/", - 763 - ], - [ - "Valid Parenthesis String", - "https://leetcode.com/problems/valid-parenthesis-string/", - 678 - ], - [ - "Eliminate Maximum Number of Monsters", - "https://leetcode.com/problems/eliminate-maximum-number-of-monsters/", - 1921 - ], - [ - "Two City Scheduling", - "https://leetcode.com/problems/two-city-scheduling/", - 1029 - ] + "Greedy":[ + [ + "Maximum Subarray", + "https://leetcode.com/problems/maximum-subarray/", + "0053" + ], + [ + "Jump Game", + "https://leetcode.com/problems/jump-game/", + "0055" + ], + [ + "Jump Game II", + "https://leetcode.com/problems/jump-game-ii/", + "0045" + ], + [ + "Jump Game VII", + "https://leetcode.com/problems/jump-game-vii/", + "1871" + ], + [ + "Gas Station", + "https://leetcode.com/problems/gas-station/", + "0134" + ], + [ + "Hand of Straights", + "https://leetcode.com/problems/hand-of-straights/", + "0846" + ], + [ + "Maximum Points You Can Obtain From Cards", + "https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards/", + "1423" + ], + [ + "Merge Triplets to Form Target Triplet", + "https://leetcode.com/problems/merge-triplets-to-form-target-triplet/", + "1898" + ], + [ + "Partition Labels", + "https://leetcode.com/problems/partition-labels/", + "0763" + ], + [ + "Valid Parenthesis String", + "https://leetcode.com/problems/valid-parenthesis-string/", + "0678" + ], + [ + "Eliminate Maximum Number of Monsters", + "https://leetcode.com/problems/eliminate-maximum-number-of-monsters/", + "1921" + ], + [ + "Two City Scheduling", + "https://leetcode.com/problems/two-city-scheduling/", + "1029" + ] ], - "Intervals": [ - [ - "Insert Interval", - "https://leetcode.com/problems/insert-interval/", - 57 - ], - [ - "Merge Intervals", - "https://leetcode.com/problems/merge-intervals/", - 56 - ], - [ - "Non Overlapping Intervals", - "https://leetcode.com/problems/non-overlapping-intervals/", - 435 - ], - [ - "Meeting Rooms", - "https://leetcode.com/problems/meeting-rooms/", - 253 - ], - [ - "Meeting Rooms II", - "https://leetcode.com/problems/meeting-rooms-ii/", - 919 - ], - [ - "Remove Covered Intervals", - "https://leetcode.com/problems/remove-covered-intervals/", - 1288 - ], - [ - "Minimum Interval to Include Each Query", - "https://leetcode.com/problems/minimum-interval-to-include-each-query/", - 1851 - ] + "Intervals":[ + [ + "Insert Interval", + "https://leetcode.com/problems/insert-interval/", + "0057" + ], + [ + "Merge Intervals", + "https://leetcode.com/problems/merge-intervals/", + "0056" + ], + [ + "Non Overlapping Intervals", + "https://leetcode.com/problems/non-overlapping-intervals/", + "0435" + ], + [ + "Meeting Rooms", + "https://leetcode.com/problems/meeting-rooms/", + "0253" + ], + [ + "Meeting Rooms II", + "https://leetcode.com/problems/meeting-rooms-ii/", + "0919" + ], + [ + "Remove Covered Intervals", + "https://leetcode.com/problems/remove-covered-intervals/", + "1288" + ], + [ + "Minimum Interval to Include Each Query", + "https://leetcode.com/problems/minimum-interval-to-include-each-query/", + "1851" + ] ], - "Math & Geometry": [ - [ - "Rotate Image", - "https://leetcode.com/problems/rotate-image/", - 48 - ], - [ - "Spiral Matrix", - "https://leetcode.com/problems/spiral-matrix/", - 54 - ], - [ - "Set Matrix Zeroes", - "https://leetcode.com/problems/set-matrix-zeroes/", - 73 - ], - [ - "Happy Number", - "https://leetcode.com/problems/happy-number/", - 202 - ], - [ - "Plus One", - "https://leetcode.com/problems/plus-one/", - 66 - ], - [ - "Palindrome Number", - "https://leetcode.com/problems/palindrome-number/", - 9 - ], - [ - "Ugly Number", - "https://leetcode.com/problems/ugly-number/", - 263 - ], - [ - "Shift 2D Grid", - "https://leetcode.com/problems/shift-2d-grid/", - 1260 - ], - [ - "Roman to Integer", - "https://leetcode.com/problems/roman-to-integer/", - 13 - ], - [ - "Integer to Roman", - "https://leetcode.com/problems/integer-to-roman/", - 12 - ], - [ - "Pow(x, n)", - "https://leetcode.com/problems/powx-n/", - 50 - ], - [ - "Multiply Strings", - "https://leetcode.com/problems/multiply-strings/", - 43 - ], - [ - "Detect Squares", - "https://leetcode.com/problems/detect-squares/", - 2013 - ], - [ - "Robot Bounded In Circle", - "https://leetcode.com/problems/robot-bounded-in-circle/", - 1041 - ], - [ - "Zigzag Conversion", - "https://leetcode.com/problems/zigzag-conversion/", - 6 - ], - [ - "Find Missing Observations", - "https://leetcode.com/problems/find-missing-observations/", - 2028 - ] + "Math & Geometry":[ + [ + "Rotate Image", + "https://leetcode.com/problems/rotate-image/", + "0048" + ], + [ + "Spiral Matrix", + "https://leetcode.com/problems/spiral-matrix/", + "0054" + ], + [ + "Set Matrix Zeroes", + "https://leetcode.com/problems/set-matrix-zeroes/", + "0073" + ], + [ + "Happy Number", + "https://leetcode.com/problems/happy-number/", + "0202" + ], + [ + "Plus One", + "https://leetcode.com/problems/plus-one/", + "0066" + ], + [ + "Palindrome Number", + "https://leetcode.com/problems/palindrome-number/", + "0009" + ], + [ + "Ugly Number", + "https://leetcode.com/problems/ugly-number/", + "0263" + ], + [ + "Shift 2D Grid", + "https://leetcode.com/problems/shift-2d-grid/", + "1260" + ], + [ + "Roman to Integer", + "https://leetcode.com/problems/roman-to-integer/", + "0013" + ], + [ + "Integer to Roman", + "https://leetcode.com/problems/integer-to-roman/", + "0012" + ], + [ + "Pow(x, n)", + "https://leetcode.com/problems/powx-n/", + "0050" + ], + [ + "Multiply Strings", + "https://leetcode.com/problems/multiply-strings/", + "0043" + ], + [ + "Detect Squares", + "https://leetcode.com/problems/detect-squares/", + "2013" + ], + [ + "Robot Bounded In Circle", + "https://leetcode.com/problems/robot-bounded-in-circle/", + "1041" + ], + [ + "Zigzag Conversion", + "https://leetcode.com/problems/zigzag-conversion/", + "0006" + ], + [ + "Find Missing Observations", + "https://leetcode.com/problems/find-missing-observations/", + "2028" + ] ], - "Bit Manipulation": [ - [ - "Single Number", - "https://leetcode.com/problems/single-number/", - 136 - ], - [ - "Number of 1 Bits", - "https://leetcode.com/problems/number-of-1-bits/", - 191 - ], - [ - "Counting Bits", - "https://leetcode.com/problems/counting-bits/", - 338 - ], - [ - "Reverse Bits", - "https://leetcode.com/problems/reverse-bits/", - 190 - ], - [ - "Missing Number", - "https://leetcode.com/problems/missing-number/", - 268 - ], - [ - "Sum of Two Integers", - "https://leetcode.com/problems/sum-of-two-integers/", - 371 - ], - [ - "Reverse Integer", - "https://leetcode.com/problems/reverse-integer/", - 7 - ], - [ - "Add Binary", - "https://leetcode.com/problems/add-binary/", - 67 - ] + "Bit Manipulation":[ + [ + "Single Number", + "https://leetcode.com/problems/single-number/", + "0136" + ], + [ + "Number of 1 Bits", + "https://leetcode.com/problems/number-of-1-bits/", + "0191" + ], + [ + "Counting Bits", + "https://leetcode.com/problems/counting-bits/", + "0338" + ], + [ + "Reverse Bits", + "https://leetcode.com/problems/reverse-bits/", + "0190" + ], + [ + "Missing Number", + "https://leetcode.com/problems/missing-number/", + "0268" + ], + [ + "Sum of Two Integers", + "https://leetcode.com/problems/sum-of-two-integers/", + "0371" + ], + [ + "Reverse Integer", + "https://leetcode.com/problems/reverse-integer/", + "0007" + ], + [ + "Add Binary", + "https://leetcode.com/problems/add-binary/", + "0067" + ] ] -} + } \ No newline at end of file diff --git a/.problemSiteData.json b/.problemSiteData.json new file mode 100644 index 000000000..3f5a02d40 --- /dev/null +++ b/.problemSiteData.json @@ -0,0 +1,4239 @@ +[ + { + "neetcode150":true, + "blind75":true, + "problem":"Contains Duplicate", + "pattern":"Arrays & Hashing", + "link":"contains-duplicate/", + "video":"3OamzN90kPg", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0217-contains-duplicate", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Valid Anagram", + "pattern":"Arrays & Hashing", + "link":"valid-anagram/", + "video":"9UtInBqnCgA", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0242-valid-anagram", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Replace Elements With Greatest Element On Right Side", + "pattern":"Arrays & Hashing", + "link":"replace-elements-with-greatest-element-on-right-side/", + "video":"ZHjKhUjcsaU", + "difficulty":"Easy", + "code":"1299-replace-elements-with-greatest-element-on-right-side", + "c":true, + "cpp":true, + "csharp":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "go":true, + "rust":true + }, + { + "problem":"Is Subsequence", + "pattern":"Arrays & Hashing", + "link":"is-subsequence/", + "video":"99RVfqklbCE", + "difficulty":"Easy", + "code":"0392-is-subsequence", + "c":true, + "cpp":true, + "csharp":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "go":true, + "rust":true + }, + { + "problem":"Length of Last Word", + "pattern":"Arrays & Hashing", + "link":"length-of-last-word/", + "video":"KT9rltZTybQ", + "difficulty":"Easy", + "code":"0058-length-of-last-word", + "c":true, + "cpp":true, + "csharp":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Two Sum", + "pattern":"Arrays & Hashing", + "link":"two-sum/", + "video":"KLlXCFG5TnA", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0001-two-sum", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "problem":"Longest Common Prefix", + "pattern":"Arrays & Hashing", + "link":"longest-common-prefix/", + "video":"0sWShKIJoo4", + "difficulty":"Easy", + "code":"0014-longest-common-prefix", + "cpp":true, + "python":true, + "javascript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Group Anagrams", + "pattern":"Arrays & Hashing", + "link":"group-anagrams/", + "video":"vzdNOK2oB2E", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0049-group-anagrams", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Pascals Triangle", + "pattern":"Arrays & Hashing", + "link":"pascals-triangle/", + "video":"nPVEaB3AjUM", + "difficulty":"Easy", + "code":"0118-pascals-triangle", + "c":true, + "cpp":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "rust":true + }, + { + "problem":"Remove Element", + "pattern":"Arrays & Hashing", + "link":"remove-element/", + "video":"Pcd1ii9P9ZI", + "difficulty":"Easy", + "code":"0027-remove-element", + "c":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "go":true + }, + { + "problem":"Unique Email Addresses", + "pattern":"Arrays & Hashing", + "link":"unique-email-addresses/", + "video":"TC_xLIWl7qY", + "difficulty":"Easy", + "code":"0929-unique-email-addresses", + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "swift":true + }, + { + "problem":"Isomorphic Strings", + "pattern":"Arrays & Hashing", + "link":"isomorphic-strings/", + "video":"7yF-U1hLEqQ", + "difficulty":"Easy", + "code":"0205-isomorphic-strings", + "c":true, + "java":true, + "python":true, + "javascript":true, + "typescript":true, + "swift":true + }, + { + "problem":"Can Place Flowers", + "pattern":"Arrays & Hashing", + "link":"can-place-flowers/", + "video":"ZGxqqjljpUI", + "difficulty":"Easy", + "code":"0605-can-place-flowers", + "c":true, + "cpp":true, + "python":true, + "javascript":true, + "typescript":true + }, + { + "problem":"Majority Element", + "pattern":"Arrays & Hashing", + "link":"majority-element/", + "video":"7pnhv842keE", + "difficulty":"Easy", + "code":"0169-majority-element", + "c":true, + "cpp":true, + "python":true, + "javascript":true, + "typescript":true, + "swift":true + }, + { + "problem":"Next Greater Element I", + "pattern":"Arrays & Hashing", + "link":"next-greater-element-i/", + "video":"68a1Dc_qVq4", + "difficulty":"Easy", + "code":"0496-next-greater-element-i", + "java":true, + "python":true, + "typescript":true + }, + { + "problem":"Find Pivot Index", + "pattern":"Arrays & Hashing", + "link":"find-pivot-index/", + "video":"u89i60lYx8U", + "difficulty":"Easy", + "code":"0724-find-pivot-index", + "c":true, + "cpp":true, + "java":true, + "python":true, + "javascript":true + }, + { + "problem":"Find All Numbers Disappeared In An Array", + "pattern":"Arrays & Hashing", + "link":"find-all-numbers-disappeared-in-an-array/", + "video":"8i-f24YFWC4", + "difficulty":"Easy", + "code":"0448-find-all-numbers-disappeared-in-an-array", + "cpp":true, + "java":true, + "python":true, + "javascript":true + }, + { + "problem":"Maximum Number of Balloons", + "pattern":"Arrays & Hashing", + "link":"maximum-number-of-balloons/", + "video":"G9xeB2-7PqY", + "difficulty":"Easy", + "code":"1189-maximum-number-of-balloons", + "c":true, + "java":true, + "python":true, + "javascript":true + }, + { + "problem":"Word Pattern", + "pattern":"Arrays & Hashing", + "link":"word-pattern/", + "video":"W_akoecmCbM", + "difficulty":"Easy", + "code":"0290-word-pattern", + "java":true, + "python":true, + "javascript":true, + "typescript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Top K Frequent Elements", + "pattern":"Arrays & Hashing", + "link":"top-k-frequent-elements/", + "video":"YPTqKIgVk-k", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0347-top-k-frequent-elements", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Product of Array Except Self", + "pattern":"Arrays & Hashing", + "link":"product-of-array-except-self/", + "video":"bNvIQI2wAjk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0238-product-of-array-except-self", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Valid Sudoku", + "pattern":"Arrays & Hashing", + "link":"valid-sudoku/", + "video":"TjFXEUCMqI8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0036-valid-sudoku", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Encode And Decode Strings", + "premium":true, + "pattern":"Arrays & Hashing", + "link":"encode-and-decode-strings/", + "video":"B1k_sxOSgv8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0271-encode-and-decode-strings", + "csharp":true, + "go":true, + "ruby":true, + "swift":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Consecutive Sequence", + "pattern":"Arrays & Hashing", + "link":"longest-consecutive-sequence/", + "video":"P6RZZMu_maU", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0128-longest-consecutive-sequence", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Sort Colors", + "pattern":"Arrays & Hashing", + "link":"sort-colors/", + "video":"4xbWSRZHqac", + "difficulty":"Medium", + "code":"0075-sort-colors", + "c":true, + "java":true, + "javascript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Encode And Decode Tinyurl", + "pattern":"Arrays & Hashing", + "link":"encode-and-decode-tinyurl/", + "video":"VyBOaboQLGc", + "difficulty":"Medium", + "code":"0535-encode-and-decode-tinyurl", + "javascript":true + }, + { + "problem":"Brick Wall", + "pattern":"Arrays & Hashing", + "link":"brick-wall/", + "video":"Kkmv2h48ekw", + "difficulty":"Medium", + "code":"0554-brick-wall", + "javascript":true, + "typescript":true + }, + { + "problem":"Best Time to Buy And Sell Stock II", + "pattern":"Arrays & Hashing", + "link":"best-time-to-buy-and-sell-stock-ii/", + "video":"3SJ3pUkPQMc", + "difficulty":"Medium", + "code":"0122-best-time-to-buy-and-sell-stock-ii", + "c":true, + "javascript":true, + "go":true + }, + { + "problem":"Subarray Sum Equals K", + "pattern":"Arrays & Hashing", + "link":"subarray-sum-equals-k/", + "video":"fFVZt-6sgyo", + "difficulty":"Medium", + "code":"0560-subarray-sum-equals-k", + "java":true + }, + { + "problem":"Unique Length 3 Palindromic Subsequences", + "pattern":"Arrays & Hashing", + "link":"unique-length-3-palindromic-subsequences/", + "video":"3THUt0vAFLU", + "difficulty":"Medium", + "code":"1930-unique-length-3-palindromic-subsequences" + }, + { + "problem":"Minimum Number of Swaps to Make The String Balanced", + "pattern":"Arrays & Hashing", + "link":"minimum-number-of-swaps-to-make-the-string-balanced/", + "video":"3YDBT9ZrfaU", + "difficulty":"Medium", + "code":"1963-minimum-number-of-swaps-to-make-the-string-balanced", + "javascript":true + }, + { + "problem":"Number of Pairs of Interchangeable Rectangles", + "pattern":"Arrays & Hashing", + "link":"number-of-pairs-of-interchangeable-rectangles/", + "video":"lEQ8ZlLOuyQ", + "difficulty":"Medium", + "code":"2001-number-of-pairs-of-interchangeable-rectangles", + "javascript":true + }, + { + "problem":"Maximum Product of The Length of Two Palindromic Subsequences", + "pattern":"Arrays & Hashing", + "link":"maximum-product-of-the-length-of-two-palindromic-subsequences/", + "video":"aoHbYlO8vDg", + "difficulty":"Medium", + "code":"2002-maximum-product-of-the-length-of-two-palindromic-subsequences" + }, + { + "problem":"Grid Game", + "pattern":"Arrays & Hashing", + "link":"grid-game/", + "video":"N4wDSOw65hI", + "difficulty":"Medium", + "code":"2017-grid-game", + "python":true + }, + { + "problem":"Find All Anagrams In a String", + "pattern":"Arrays & Hashing", + "link":"find-all-anagrams-in-a-string/", + "video":"G8xtZy0fDKg", + "difficulty":"Medium", + "code":"0438-find-all-anagrams-in-a-string", + "cpp":true, + "csharp":true, + "python":true + }, + { + "problem":"Find The Index of The First Occurrence In a String", + "pattern":"Arrays & Hashing", + "link":"find-the-index-of-the-first-occurrence-in-a-string/", + "video":"JoF0Z7nVSrA", + "difficulty":"Medium", + "code":"0028-find-the-index-of-the-first-occurrence-in-a-string", + "python":true + }, + { + "problem":"Wiggle Sort", + "pattern":"Arrays & Hashing", + "link":"wiggle-sort/", + "video":"vGsyTE4s34w", + "difficulty":"Medium", + "code":"0280-wiggle-sort" + }, + { + "problem":"Largest Number", + "pattern":"Arrays & Hashing", + "link":"largest-number/", + "video":"WDx6Y4i4xJ8", + "difficulty":"Medium", + "code":"0179-largest-number", + "typescript":true + }, + { + "problem":"Continuous Subarray Sum", + "pattern":"Arrays & Hashing", + "link":"continuous-subarray-sum/", + "video":"OKcrLfR-8mE", + "difficulty":"Medium", + "code":"0523-continuous-subarray-sum", + "java":true, + "python":true + }, + { + "problem":"Push Dominoes", + "pattern":"Arrays & Hashing", + "link":"push-dominoes/", + "video":"evUFsOb_iLY", + "difficulty":"Medium", + "code":"0838-push-dominoes" + }, + { + "problem":"Repeated Dna Sequences", + "pattern":"Arrays & Hashing", + "link":"repeated-dna-sequences/", + "video":"FzTYfsmtOso", + "difficulty":"Medium", + "code":"0187-repeated-dna-sequences", + "java":true + }, + { + "problem":"Insert Delete Get Random O(1)", + "pattern":"Arrays & Hashing", + "link":"insert-delete-getrandom-o1/", + "video":"j4KwhBziOpg", + "difficulty":"Medium", + "code":"0380-insert-delete-getrandom-o1", + "java":true, + "typescript":true + }, + { + "problem":"Check if a String Contains All Binary Codes of Size K", + "pattern":"Arrays & Hashing", + "link":"check-if-a-string-contains-all-binary-codes-of-size-k/", + "video":"qU32rTy_kOM", + "difficulty":"Medium", + "code":"1461-check-if-a-string-contains-all-binary-codes-of-size-k" + }, + { + "problem":"Range Sum Query 2D Immutable", + "pattern":"Arrays & Hashing", + "link":"range-sum-query-2d-immutable/", + "video":"KE8MQuwE2yA", + "difficulty":"Medium", + "code":"0304-range-sum-query-2d-immutable" + }, + { + "problem":"Non Decreasing Array", + "pattern":"Arrays & Hashing", + "link":"non-decreasing-array/", + "video":"RegQckCegDk", + "difficulty":"Medium", + "code":"0665-non-decreasing-array" + }, + { + "problem":"First Missing Positive", + "pattern":"Arrays & Hashing", + "link":"first-missing-positive/", + "video":"8g78yfzMlao", + "difficulty":"Hard", + "code":"0041-first-missing-positive", + "python":true, + "typescript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Valid Palindrome", + "pattern":"Two Pointers", + "link":"valid-palindrome/", + "video":"jJXJ16kPFWg", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0125-valid-palindrome", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Valid Palindrome II", + "pattern":"Two Pointers", + "link":"valid-palindrome-ii/", + "video":"JrxRYBwG6EI", + "difficulty":"Easy", + "code":"0680-valid-palindrome-ii", + "python":true + }, + { + "problem":"Minimum Difference Between Highest And Lowest of K Scores", + "pattern":"Two Pointers", + "link":"minimum-difference-between-highest-and-lowest-of-k-scores/", + "video":"JU5XdBZZtlk", + "difficulty":"Easy", + "code":"1984-minimum-difference-between-highest-and-lowest-of-k-scores", + "javascript":true + }, + { + "problem":"Reverse String", + "pattern":"Two Pointers", + "link":"reverse-string/", + "video":"_d0T_2Lk2qA", + "difficulty":"Easy", + "code":"0344-reverse-string", + "c":true, + "python":true, + "javascript":true, + "typescript":true, + "swift":true + }, + { + "problem":"Merge Sorted Array", + "pattern":"Two Pointers", + "link":"merge-sorted-array/", + "video":"P1Ic85RarKY", + "difficulty":"Easy", + "code":"0088-merge-sorted-array", + "c":true, + "java":true, + "javascript":true + }, + { + "problem":"Move Zeroes", + "pattern":"Two Pointers", + "link":"move-zeroes/", + "video":"aayNRwUN3Do", + "difficulty":"Easy", + "code":"0283-move-zeroes", + "c":true, + "cpp":true, + "javascript":true + }, + { + "problem":"Remove Duplicates From Sorted Array", + "pattern":"Two Pointers", + "link":"remove-duplicates-from-sorted-array/", + "video":"DEJAZBq0FDA", + "difficulty":"Easy", + "code":"0026-remove-duplicates-from-sorted-array", + "python":true, + "javascript":true, + "go":true + }, + { + "neetcode150":true, + "problem":"Two Sum II Input Array Is Sorted", + "pattern":"Two Pointers", + "link":"two-sum-ii-input-array-is-sorted/", + "video":"cQ1Oz4ckceM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0167-two-sum-ii-input-array-is-sorted", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"3Sum", + "pattern":"Two Pointers", + "link":"3sum/", + "video":"jzZsG8n2R9A", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0015-3sum", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "problem":"4Sum", + "pattern":"Two Pointers", + "link":"4sum/", + "video":"EYeR-_1NRlQ", + "difficulty":"Medium", + "code":"0018-4sum", + "python":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Container With Most Water", + "pattern":"Two Pointers", + "link":"container-with-most-water/", + "video":"UuiTKBwPgAo", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0011-container-with-most-water", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Number of Subsequences That Satisfy The Given Sum Condition", + "pattern":"Two Pointers", + "link":"number-of-subsequences-that-satisfy-the-given-sum-condition/", + "video":"xCsIkPLS4Ls", + "difficulty":"Medium", + "code":"1498-number-of-subsequences-that-satisfy-the-given-sum-condition" + }, + { + "problem":"Rotate Array", + "pattern":"Two Pointers", + "link":"rotate-array/", + "video":"BHr381Guz3Y", + "difficulty":"Medium", + "code":"0189-rotate-array", + "cpp":true + }, + { + "problem":"Array With Elements Not Equal to Average of Neighbors", + "pattern":"Two Pointers", + "link":"array-with-elements-not-equal-to-average-of-neighbors/", + "video":"Wmb3YdVYfqM", + "difficulty":"Medium", + "code":"1968-array-with-elements-not-equal-to-average-of-neighbors", + "c":true + }, + { + "problem":"Boats to Save People", + "pattern":"Two Pointers", + "link":"boats-to-save-people/", + "video":"XbaxWuHIWUs", + "difficulty":"Medium", + "code":"0881-boats-to-save-people", + "c":true + }, + { + "neetcode150":true, + "problem":"Trapping Rain Water", + "pattern":"Two Pointers", + "link":"trapping-rain-water/", + "video":"ZI2z5pq0TqA", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0042-trapping-rain-water", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Best Time to Buy And Sell Stock", + "pattern":"Sliding Window", + "link":"best-time-to-buy-and-sell-stock/", + "video":"1pkOgXD63yU", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0121-best-time-to-buy-and-sell-stock", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Substring Without Repeating Characters", + "pattern":"Sliding Window", + "link":"longest-substring-without-repeating-characters/", + "video":"wiGpQwVHdE0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0003-longest-substring-without-repeating-characters", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Repeating Character Replacement", + "pattern":"Sliding Window", + "link":"longest-repeating-character-replacement/", + "video":"gqXU1UyA8pk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0424-longest-repeating-character-replacement", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Permutation In String", + "pattern":"Sliding Window", + "link":"permutation-in-string/", + "video":"UbyhOgBN834", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0567-permutation-in-string", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Frequency of The Most Frequent Element", + "pattern":"Sliding Window", + "link":"frequency-of-the-most-frequent-element/", + "video":"vgBrQ0NM5vE", + "difficulty":"Medium", + "code":"1838-frequency-of-the-most-frequent-element", + "csharp":true + }, + { + "problem":"Minimum Number of Flips to Make The Binary String Alternating", + "pattern":"Sliding Window", + "link":"minimum-number-of-flips-to-make-the-binary-string-alternating/", + "video":"MOeuK6gaC2A", + "difficulty":"Medium", + "code":"1888-minimum-number-of-flips-to-make-the-binary-string-alternating" + }, + { + "problem":"Minimum Size Subarray Sum", + "pattern":"Sliding Window", + "link":"minimum-size-subarray-sum/", + "video":"aYqYMIqZx5s", + "difficulty":"Medium", + "code":"0209-minimum-size-subarray-sum", + "c":true, + "cpp":true + }, + { + "problem":"Find K Closest Elements", + "pattern":"Sliding Window", + "link":"find-k-closest-elements/", + "video":"o-YDQzHoaKM", + "difficulty":"Medium", + "code":"0658-find-k-closest-elements", + "python":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Minimum Window Substring", + "pattern":"Sliding Window", + "link":"minimum-window-substring/", + "video":"jSto0O4AJbM", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0076-minimum-window-substring", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Sliding Window Maximum", + "pattern":"Sliding Window", + "link":"sliding-window-maximum/", + "video":"DfljaUwZsOk", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0239-sliding-window-maximum", + "csharp":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Valid Parentheses", + "pattern":"Stack", + "link":"valid-parentheses/", + "video":"WTzjTskDFMg", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0020-valid-parentheses", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "problem":"Baseball Game", + "pattern":"Stack", + "link":"baseball-game/", + "video":"Id_tqGdsZQI", + "difficulty":"Easy", + "code":"0682-baseball-game", + "c":true, + "cpp":true, + "python":true + }, + { + "problem":"Implement Stack Using Queues", + "pattern":"Stack", + "link":"implement-stack-using-queues/", + "video":"rW4vm0-DLYc", + "difficulty":"Easy", + "code":"0225-implement-stack-using-queues", + "cpp":true, + "go":true + }, + { + "neetcode150":true, + "problem":"Min Stack", + "pattern":"Stack", + "link":"min-stack/", + "video":"qkLl7nAwDPo", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0155-min-stack", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Evaluate Reverse Polish Notation", + "pattern":"Stack", + "link":"evaluate-reverse-polish-notation/", + "video":"iu0082c4HDE", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0150-evaluate-reverse-polish-notation", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Generate Parentheses", + "pattern":"Stack", + "link":"generate-parentheses/", + "video":"s9fokUqJ76A", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0022-generate-parentheses", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "kotlin":true + }, + { + "problem":"Asteroid Collision", + "pattern":"Stack", + "link":"asteroid-collision/", + "video":"LN7KjRszjk4", + "difficulty":"Medium", + "code":"0735-asteroid-collision" + }, + { + "neetcode150":true, + "problem":"Daily Temperatures", + "pattern":"Stack", + "link":"daily-temperatures/", + "video":"cTBiBSnjO3c", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0739-daily-temperatures", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Online Stock Span", + "pattern":"Stack", + "link":"online-stock-span/", + "video":"slYh0ZNEqSw", + "difficulty":"Medium", + "code":"0901-online-stock-span", + "python":true + }, + { + "neetcode150":true, + "problem":"Car Fleet", + "pattern":"Stack", + "link":"car-fleet/", + "video":"Pr6T-3yB9RM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0853-car-fleet", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "kotlin":true + }, + { + "problem":"Simplify Path", + "pattern":"Stack", + "link":"simplify-path/", + "video":"qYlHrAKJfyA", + "difficulty":"Medium", + "code":"0071-simplify-path", + "python":true, + "typescript":true + }, + { + "problem":"Decode String", + "pattern":"Stack", + "link":"decode-string/", + "video":"qB0zZpBJlh8", + "difficulty":"Medium", + "code":"0394-decode-string", + "python":true + }, + { + "problem":"Remove K Digits", + "pattern":"Stack", + "link":"remove-k-digits/", + "video":"cFabMOnJaq0", + "difficulty":"Medium", + "code":"0402-remove-k-digits", + "cpp":true + }, + { + "problem":"Remove All Adjacent Duplicates In String II", + "pattern":"Stack", + "link":"remove-all-adjacent-duplicates-in-string-ii/", + "video":"w6LcypDgC4w", + "difficulty":"Medium", + "code":"1209-remove-all-adjacent-duplicates-in-string-ii", + "cpp":true, + "python":true, + "javascript":true + }, + { + "problem":"132 Pattern", + "pattern":"Stack", + "link":"132-pattern/", + "video":"q5ANAl8Z458", + "difficulty":"Medium", + "code":"0132-132-pattern" + }, + { + "problem":"Maximum Frequency Stack", + "pattern":"Stack", + "link":"maximum-frequency-stack/", + "video":"Z6idIicFDOE", + "difficulty":"Hard", + "code":"0895-maximum-frequency-stack" + }, + { + "neetcode150":true, + "problem":"Largest Rectangle In Histogram", + "pattern":"Stack", + "link":"largest-rectangle-in-histogram/", + "video":"zx5Sw9130L0", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0084-largest-rectangle-in-histogram", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Binary Search", + "pattern":"Binary Search", + "link":"binary-search/", + "video":"s4DPM8ct1pI", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0704-binary-search", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Search Insert Position", + "pattern":"Binary Search", + "link":"search-insert-position/", + "video":"K-RYzDZkzCI", + "difficulty":"Easy", + "code":"0035-search-insert-position", + "c":true, + "cpp":true, + "python":true, + "javascript":true, + "swift":true + }, + { + "problem":"Guess Number Higher Or Lower", + "pattern":"Binary Search", + "link":"guess-number-higher-or-lower/", + "video":"xW4QsTtaCa4", + "difficulty":"Easy", + "code":"0374-guess-number-higher-or-lower", + "c":true, + "python":true + }, + { + "problem":"Arranging Coins", + "pattern":"Binary Search", + "link":"arranging-coins/", + "video":"5rHz_6s2Buw", + "difficulty":"Easy", + "code":"0441-arranging-coins", + "python":true + }, + { + "problem":"Squares of a Sorted Array", + "pattern":"Binary Search", + "link":"squares-of-a-sorted-array/", + "video":"FPCZsG_AkUg", + "difficulty":"Easy", + "code":"0977-squares-of-a-sorted-array", + "cpp":true, + "python":true + }, + { + "problem":"Valid Perfect Square", + "pattern":"Binary Search", + "link":"valid-perfect-square/", + "video":"Cg_wWPHJ2Sk", + "difficulty":"Easy", + "code":"0367-valid-perfect-square", + "python":true, + "javascript":true + }, + { + "neetcode150":true, + "problem":"Search a 2D Matrix", + "pattern":"Binary Search", + "link":"search-a-2d-matrix/", + "video":"Ber2pi2C0j0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0074-search-a-2d-matrix", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Koko Eating Bananas", + "pattern":"Binary Search", + "link":"koko-eating-bananas/", + "video":"U2SozAs9RzA", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0875-koko-eating-bananas", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Search In Rotated Sorted Array", + "pattern":"Binary Search", + "link":"search-in-rotated-sorted-array/", + "video":"U8XENwh8Oy8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0033-search-in-rotated-sorted-array", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Find Minimum In Rotated Sorted Array", + "pattern":"Binary Search", + "link":"find-minimum-in-rotated-sorted-array/", + "video":"nIVW4P8b1VA", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0153-find-minimum-in-rotated-sorted-array", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "problem":"Time Based Key Value Store", + "pattern":"Binary Search", + "link":"time-based-key-value-store/", + "video":"fu2cD_6E8Hw", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0981-time-based-key-value-store", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Find First And Last Position of Element In Sorted Array", + "pattern":"Binary Search", + "link":"find-first-and-last-position-of-element-in-sorted-array/", + "video":"4sQL7R5ySUU", + "difficulty":"Medium", + "code":"0034-find-first-and-last-position-of-element-in-sorted-array", + "csharp":true, + "python":true + }, + { + "problem":"Maximum Number of Removable Characters", + "pattern":"Binary Search", + "link":"maximum-number-of-removable-characters/", + "video":"NMP3nRPyX5g", + "difficulty":"Medium", + "code":"1898-maximum-number-of-removable-characters" + }, + { + "problem":"Populating Next Right Pointers In Each Node", + "pattern":"Binary Search", + "link":"populating-next-right-pointers-in-each-node/", + "video":"U4hFQCa1Cq0", + "difficulty":"Medium", + "code":"0116-populating-next-right-pointers-in-each-node" + }, + { + "problem":"Search Suggestions System", + "pattern":"Binary Search", + "link":"search-suggestions-system/", + "video":"D4T2N0yAr20", + "difficulty":"Medium", + "code":"1268-search-suggestions-system" + }, + { + "problem":"Split Array Largest Sum", + "pattern":"Binary Search", + "link":"split-array-largest-sum/", + "video":"YUF3_eBdzsk", + "difficulty":"Hard", + "code":"0410-split-array-largest-sum", + "python":true + }, + { + "neetcode150":true, + "problem":"Median of Two Sorted Arrays", + "pattern":"Binary Search", + "link":"median-of-two-sorted-arrays/", + "video":"q6IEA26hvXc", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0004-median-of-two-sorted-arrays", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Reverse Linked List", + "pattern":"Linked List", + "link":"reverse-linked-list/", + "video":"G0_I-ZF0S38", + "difficulty":"Easy", + "python":true, + "cpp":true, + "javascript":true, + "code":"0206-reverse-linked-list", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Merge Two Sorted Lists", + "pattern":"Linked List", + "link":"merge-two-sorted-lists/", + "video":"XIdigk956u0", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0021-merge-two-sorted-lists", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "problem":"Palindrome Linked List", + "pattern":"Linked List", + "link":"palindrome-linked-list/", + "video":"yOzXms1J6Nk", + "difficulty":"Easy", + "code":"0234-palindrome-linked-list", + "cpp":true, + "javascript":true + }, + { + "problem":"Remove Linked List Elements", + "pattern":"Linked List", + "link":"remove-linked-list-elements/", + "video":"JI71sxtHTng", + "difficulty":"Easy", + "code":"0203-remove-linked-list-elements", + "javascript":true, + "typescript":true, + "go":true + }, + { + "problem":"Remove Duplicates From Sorted List", + "pattern":"Linked List", + "link":"remove-duplicates-from-sorted-list/", + "video":"p10f-VpO4nE", + "difficulty":"Easy", + "code":"0083-remove-duplicates-from-sorted-list", + "cpp":true, + "python":true, + "javascript":true, + "go":true + }, + { + "problem":"Intersection of Two Linked Lists", + "pattern":"Linked List", + "link":"intersection-of-two-linked-lists/", + "video":"D0X0BONOQhI", + "difficulty":"Easy", + "code":"0160-intersection-of-two-linked-lists", + "python":true, + "javascript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Reorder List", + "pattern":"Linked List", + "link":"reorder-list/", + "video":"S5bfdUTrKLM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0143-reorder-list", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Remove Nth Node From End of List", + "pattern":"Linked List", + "link":"remove-nth-node-from-end-of-list/", + "video":"XVuQxVej6y8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0019-remove-nth-node-from-end-of-list", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Copy List With Random Pointer", + "pattern":"Linked List", + "link":"copy-list-with-random-pointer/", + "video":"5Y2EiZST97Y", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0138-copy-list-with-random-pointer", + "c":true, + "csharp":true, + "typescript":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Add Two Numbers", + "pattern":"Linked List", + "link":"add-two-numbers/", + "video":"wgFPrzTjm7s", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0002-add-two-numbers", + "c":true, + "csharp":true, + "typescript":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Linked List Cycle", + "pattern":"Linked List", + "link":"linked-list-cycle/", + "video":"gBTe7lFR3vc", + "difficulty":"Easy", + "python":true, + "cpp":true, + "javascript":true, + "code":"0141-linked-list-cycle", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "problem":"Find The Duplicate Number", + "pattern":"Linked List", + "link":"find-the-duplicate-number/", + "video":"wjYnzkAhcNk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0287-find-the-duplicate-number", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Swap Nodes In Pairs", + "pattern":"Linked List", + "link":"swap-nodes-in-pairs/", + "video":"o811TZLAWOo", + "difficulty":"Medium", + "code":"0024-swap-nodes-in-pairs", + "python":true, + "go":true + }, + { + "problem":"Sort List", + "pattern":"Linked List", + "link":"sort-list/", + "video":"TGveA1oFhrc", + "difficulty":"Medium", + "code":"0147-insertion-sort-list" + }, + { + "problem":"Partition List", + "pattern":"Linked List", + "link":"partition-list/", + "video":"KT1iUciJr4g", + "difficulty":"Medium", + "code":"0086-partition-list" + }, + { + "problem":"Rotate List", + "pattern":"Linked List", + "link":"rotate-list/", + "video":"UcGtPs2LE_c", + "difficulty":"Medium", + "code":"0061-rotate-list" + }, + { + "problem":"Reverse Linked List II", + "pattern":"Linked List", + "link":"reverse-linked-list-ii/", + "video":"RF_M9tX4Eag", + "difficulty":"Medium", + "code":"0092-reverse-linked-list-ii", + "python":true, + "javascript":true + }, + { + "problem":"Design Circular Queue", + "pattern":"Linked List", + "link":"design-circular-queue/", + "video":"aBbsfn863oA", + "difficulty":"Medium", + "code":"0622-design-circular-queue" + }, + { + "problem":"Insertion Sort List", + "pattern":"Linked List", + "link":"insertion-sort-list/", + "video":"Kk6mXAzqX3Y", + "difficulty":"Medium" + }, + { + "neetcode150":true, + "problem":"LRU Cache", + "pattern":"Linked List", + "link":"lru-cache/", + "video":"7ABFKPK2hD4", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0146-lru-cache", + "c":true, + "csharp":true, + "ruby":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Merge K Sorted Lists", + "pattern":"Linked List", + "link":"merge-k-sorted-lists/", + "video":"q5a5OiGbT6Q", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0023-merge-k-sorted-lists", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Reverse Nodes In K Group", + "pattern":"Linked List", + "link":"reverse-nodes-in-k-group/", + "video":"1UOPsfP85V4", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0025-reverse-nodes-in-k-group", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "problem":"Binary Tree Inorder Traversal", + "pattern":"Trees", + "link":"binary-tree-inorder-traversal/", + "video":"g_S5WuasWUE", + "difficulty":"Easy", + "code":"0094-binary-tree-inorder-traversal", + "c":true, + "python":true, + "javascript":true, + "typescript":true, + "ruby":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Invert Binary Tree", + "pattern":"Trees", + "link":"invert-binary-tree/", + "video":"OnSn2XEQ4MY", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0226-invert-binary-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Maximum Depth of Binary Tree", + "pattern":"Trees", + "link":"maximum-depth-of-binary-tree/", + "video":"hTM3phVI6YQ", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0104-maximum-depth-of-binary-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Diameter of Binary Tree", + "pattern":"Trees", + "link":"diameter-of-binary-tree/", + "video":"bkxqA8Rfv04", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0543-diameter-of-binary-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Balanced Binary Tree", + "pattern":"Trees", + "link":"balanced-binary-tree/", + "video":"QfJsau0ItOY", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0110-balanced-binary-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Same Tree", + "pattern":"Trees", + "link":"same-tree/", + "video":"vRbbcKXCxOw", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0100-same-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Subtree of Another Tree", + "pattern":"Trees", + "link":"subtree-of-another-tree/", + "video":"E36O5SWp-LE", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0572-subtree-of-another-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "problem":"Convert Sorted Array to Binary Search Tree", + "pattern":"Trees", + "link":"convert-sorted-array-to-binary-search-tree/", + "video":"0K0uCMYq5ng", + "difficulty":"Easy", + "code":"0108-convert-sorted-array-to-binary-search-tree", + "c":true, + "javascript":true + }, + { + "problem":"Merge Two Binary Trees", + "pattern":"Trees", + "link":"merge-two-binary-trees/", + "video":"QHH6rIK3dDQ", + "difficulty":"Easy", + "code":"0617-merge-two-binary-trees", + "c":true, + "java":true, + "python":true, + "javascript":true + }, + { + "problem":"Path Sum", + "pattern":"Trees", + "link":"path-sum/", + "video":"LSKQyOz_P8I", + "difficulty":"Easy", + "code":"0064-minimum-path-sum", + "cpp":true, + "java":true, + "python":true + }, + { + "problem":"Construct String From Binary Tree", + "pattern":"Trees", + "link":"construct-string-from-binary-tree/", + "video":"b1WpYxnuebQ", + "difficulty":"Easy", + "code":"0606-construct-string-from-binary-tree" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Lowest Common Ancestor of a Binary Search Tree", + "pattern":"Trees", + "link":"lowest-common-ancestor-of-a-binary-search-tree/", + "video":"gs2LMfuOR9k", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0235-lowest-common-ancestor-of-a-binary-search-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Binary Tree Level Order Traversal", + "pattern":"Trees", + "link":"binary-tree-level-order-traversal/", + "video":"6ZnyEApgFYg", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0102-binary-tree-level-order-traversal", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Binary Tree Right Side View", + "pattern":"Trees", + "link":"binary-tree-right-side-view/", + "video":"d4zLyf32e3I", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0199-binary-tree-right-side-view", + "c":true, + "csharp":true, + "typescript":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Count Good Nodes In Binary Tree", + "pattern":"Trees", + "link":"count-good-nodes-in-binary-tree/", + "video":"7cp5imvDzl4", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"1448-count-good-nodes-in-binary-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Validate Binary Search Tree", + "pattern":"Trees", + "link":"validate-binary-search-tree/", + "video":"s6ATEkipzow", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0098-validate-binary-search-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Kth Smallest Element In a Bst", + "pattern":"Trees", + "link":"kth-smallest-element-in-a-bst/", + "video":"5LUXSvjmGCw", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0230-kth-smallest-element-in-a-bst", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Construct Binary Tree From Preorder And Inorder Traversal", + "pattern":"Trees", + "link":"construct-binary-tree-from-preorder-and-inorder-traversal/", + "video":"ihj4IQGZ2zc", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0105-construct-binary-tree-from-preorder-and-inorder-traversal", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "problem":"Unique Binary Search Trees", + "pattern":"Trees", + "link":"unique-binary-search-trees/", + "video":"Ox0TenN3Zpg", + "difficulty":"Medium", + "code":"0096-unique-binary-search-trees", + "c":true + }, + { + "problem":"Sum Root to Leaf Numbers", + "pattern":"Trees", + "link":"sum-root-to-leaf-numbers/", + "video":"Jk16lZGFWxE", + "difficulty":"Medium", + "code":"0129-sum-root-to-leaf-numbers", + "c":true + }, + { + "problem":"House Robber III", + "pattern":"Trees", + "link":"house-robber-iii/", + "video":"nHR8ytpzz7c", + "difficulty":"Medium", + "code":"0337-house-robber-iii" + }, + { + "problem":"Flip Equivalent Binary Trees", + "pattern":"Trees", + "link":"flip-equivalent-binary-trees/", + "video":"izRDc1il9Pk", + "difficulty":"Medium", + "code":"0951-flip-equivalent-binary-trees" + }, + { + "problem":"Operations On Tree", + "pattern":"Trees", + "link":"operations-on-tree/", + "video":"qK4PtjrVD0U", + "difficulty":"Medium", + "code":"1993-operations-on-tree" + }, + { + "problem":"All Possible Full Binary Trees", + "pattern":"Trees", + "link":"all-possible-full-binary-trees/", + "video":"nZtrZPTTCAo", + "difficulty":"Medium", + "code":"0894-all-possible-full-binary-trees" + }, + { + "problem":"Find Bottom Left Tree Value", + "pattern":"Trees", + "link":"find-bottom-left-tree-value/", + "video":"u_by_cTsNJA", + "difficulty":"Medium", + "code":"0513-find-bottom-left-tree-value", + "java":true + }, + { + "problem":"Trim a Binary Search Tree", + "pattern":"Trees", + "link":"trim-a-binary-search-tree/", + "video":"jwt5mTjEXGc", + "difficulty":"Medium", + "code":"0669-trim-a-binary-search-tree", + "python":true, + "javascript":true, + "typescript":true + }, + { + "problem":"Binary Search Tree Iterator", + "pattern":"Trees", + "link":"binary-search-tree-iterator/", + "video":"RXy5RzGF5wo", + "difficulty":"Medium", + "code":"0173-binary-search-tree-iterator", + "java":true, + "javascript":true + }, + { + "problem":"Convert Bst to Greater Tree", + "pattern":"Trees", + "link":"convert-bst-to-greater-tree/", + "video":"7vVEJwVvAlI", + "difficulty":"Medium", + "code":"0538-convert-bst-to-greater-tree" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Binary Tree Maximum Path Sum", + "pattern":"Trees", + "link":"binary-tree-maximum-path-sum/", + "video":"Hr5cWUld4vU", + "difficulty":"Hard" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Serialize And Deserialize Binary Tree", + "pattern":"Trees", + "link":"serialize-and-deserialize-binary-tree/", + "video":"u4JAi2JJhI8", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0297-serialize-and-deserialize-binary-tree", + "c":true, + "csharp":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Implement Trie Prefix Tree", + "pattern":"Tries", + "link":"implement-trie-prefix-tree/", + "video":"oobqoCJlHA0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0208-implement-trie-prefix-tree", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Design Add And Search Words Data Structure", + "pattern":"Tries", + "link":"design-add-and-search-words-data-structure/", + "video":"BTf05gs_8iU", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0211-design-add-and-search-words-data-structure", + "csharp":true, + "typescript":true, + "ruby":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Word Search II", + "pattern":"Tries", + "link":"word-search-ii/", + "video":"asbcE9mZz_U", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0212-word-search-ii", + "csharp":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Kth Largest Element In a Stream", + "pattern":"Heap / Priority Queue", + "link":"kth-largest-element-in-a-stream/", + "video":"hOjcdrqMoQ8", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0703-kth-largest-element-in-a-stream", + "c":true, + "csharp":true, + "ruby":true, + "swift":true + }, + { + "neetcode150":true, + "problem":"Last Stone Weight", + "pattern":"Heap / Priority Queue", + "link":"last-stone-weight/", + "video":"B-QCq79-Vfw", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"1046-last-stone-weight", + "csharp":true, + "typescript":true, + "ruby":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"K Closest Points to Origin", + "pattern":"Heap / Priority Queue", + "link":"k-closest-points-to-origin/", + "video":"rI2EBUEMfTk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0973-k-closest-points-to-origin", + "csharp":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Kth Largest Element In An Array", + "pattern":"Heap / Priority Queue", + "link":"kth-largest-element-in-an-array/", + "video":"XEmy13g1Qxc", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0215-kth-largest-element-in-an-array", + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Task Scheduler", + "pattern":"Heap / Priority Queue", + "link":"task-scheduler/", + "video":"s8p8ukTyA2I", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0621-task-scheduler", + "csharp":true, + "typescript":true + }, + { + "neetcode150":true, + "problem":"Design Twitter", + "pattern":"Heap / Priority Queue", + "link":"design-twitter/", + "video":"pNichitDD2E", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0355-design-twitter", + "csharp":true + }, + { + "problem":"Single Threaded Cpu", + "pattern":"Heap / Priority Queue", + "link":"single-threaded-cpu/", + "video":"RR1n-d4oYqE", + "difficulty":"Medium", + "code":"1834-single-threaded-cpu" + }, + { + "problem":"Seat Reservation Manager", + "pattern":"Heap / Priority Queue", + "link":"seat-reservation-manager/", + "video":"ahobllKXEEY", + "difficulty":"Medium", + "code":"1845-seat-reservation-manager", + "python":true + }, + { + "problem":"Process Tasks Using Servers", + "pattern":"Heap / Priority Queue", + "link":"process-tasks-using-servers/", + "video":"XKA22PecuMQ", + "difficulty":"Medium", + "code":"1882-process-tasks-using-servers" + }, + { + "problem":"Find The Kth Largest Integer In The Array", + "pattern":"Heap / Priority Queue", + "link":"find-the-kth-largest-integer-in-the-array/", + "video":"lRCaNiqO3xI", + "difficulty":"Medium", + "code":"1985-find-the-kth-largest-integer-in-the-array", + "java":true, + "python":true, + "swift":true + }, + { + "problem":"Reorganize String", + "pattern":"Heap / Priority Queue", + "link":"reorganize-string/", + "video":"2g_b1aYTHeg", + "difficulty":"Medium", + "code":"0767-reorganize-string", + "java":true, + "python":true + }, + { + "problem":"Longest Happy String", + "pattern":"Heap / Priority Queue", + "link":"longest-happy-string/", + "video":"8u-H6O_XQKE", + "difficulty":"Medium", + "code":"1405-longest-happy-string" + }, + { + "problem":"Car Pooling", + "pattern":"Heap / Priority Queue", + "link":"car-pooling/", + "video":"08sn_w4LWEE", + "difficulty":"Medium", + "code":"1094-car-pooling", + "csharp":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Find Median From Data Stream", + "pattern":"Heap / Priority Queue", + "link":"find-median-from-data-stream/", + "video":"itmhHWaHupI", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0295-find-median-from-data-stream", + "csharp":true, + "kotlin":true + }, + { + "problem":"Maximum Performance of a Team", + "pattern":"Heap / Priority Queue", + "link":"maximum-performance-of-a-team/", + "video":"Y7UTvogADH0", + "difficulty":"Hard", + "code":"1383-maximum-performance-of-a-team", + "csharp":true, + "python":true + }, + { + "neetcode150":true, + "problem":"Subsets", + "pattern":"Backtracking", + "link":"subsets/", + "video":"REOH22Xwdkk", + "difficulty":"Medium", + "code":"0698-partition-to-k-equal-sum-subsets", + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Combination Sum", + "pattern":"Backtracking", + "link":"combination-sum/", + "video":"GBKI9VSKdGg", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0039-combination-sum", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Combinations", + "pattern":"Backtracking", + "link":"combinations/", + "video":"q0s6m7AiM7o", + "difficulty":"Medium", + "code":"0077-combinations", + "python":true + }, + { + "neetcode150":true, + "problem":"Permutations", + "pattern":"Backtracking", + "link":"permutations/", + "video":"s7AvT7cGdSo", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0046-permutations", + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Subsets II", + "pattern":"Backtracking", + "link":"subsets-ii/", + "video":"Vn2v6ajA7U0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0090-subsets-ii", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Combination Sum II", + "pattern":"Backtracking", + "link":"combination-sum-ii/", + "video":"rSA3t6BDDwg", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0040-combination-sum-ii", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Permutations II", + "pattern":"Backtracking", + "link":"permutations-ii/", + "video":"qhBVWf0YafA", + "difficulty":"Medium", + "code":"0047-permutations-ii" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Word Search", + "pattern":"Backtracking", + "link":"word-search/", + "video":"pfiQ_PS1g8E", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0079-word-search", + "c":true, + "csharp":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Palindrome Partitioning", + "pattern":"Backtracking", + "link":"palindrome-partitioning/", + "video":"3jvWodd7ht0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0131-palindrome-partitioning", + "csharp":true, + "typescript":true, + "go":true + }, + { + "problem":"Restore Ip Addresses", + "pattern":"Backtracking", + "link":"restore-ip-addresses/", + "video":"61tN4YEdiTM", + "difficulty":"Medium", + "code":"0093-restore-ip-addresses" + }, + { + "neetcode150":true, + "problem":"Letter Combinations of a Phone Number", + "pattern":"Backtracking", + "link":"letter-combinations-of-a-phone-number/", + "video":"0snEunUacZY", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0017-letter-combinations-of-a-phone-number", + "csharp":true, + "typescript":true, + "go":true, + "ruby":true + }, + { + "problem":"Matchsticks to Square", + "pattern":"Backtracking", + "link":"matchsticks-to-square/", + "video":"hUe0cUKV-YY", + "difficulty":"Medium", + "code":"0473-matchsticks-to-square", + "cpp":true, + "python":true, + "javascript":true + }, + { + "problem":"Splitting a String Into Descending Consecutive Values", + "pattern":"Backtracking", + "link":"splitting-a-string-into-descending-consecutive-values/", + "video":"eDtMmysldaw", + "difficulty":"Medium", + "code":"1849-splitting-a-string-into-descending-consecutive-values", + "python":true + }, + { + "problem":"Find Unique Binary String", + "pattern":"Backtracking", + "link":"find-unique-binary-string/", + "video":"aHqn4Dynd1k", + "difficulty":"Medium", + "code":"1980-find-unique-binary-string", + "python":true + }, + { + "problem":"Maximum Length of a Concatenated String With Unique Characters", + "pattern":"Backtracking", + "link":"maximum-length-of-a-concatenated-string-with-unique-characters/", + "video":"d4SPuvkaeoo", + "difficulty":"Medium", + "code":"1239-maximum-length-of-a-concatenated-string-with-unique-characters", + "python":true + }, + { + "problem":"Partition to K Equal Sum Subsets", + "pattern":"Backtracking", + "link":"partition-to-k-equal-sum-subsets/", + "video":"mBk4I0X46oI", + "difficulty":"Medium" + }, + { + "neetcode150":true, + "problem":"N Queens", + "pattern":"Backtracking", + "link":"n-queens/", + "video":"Ph95IHmRp5M", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0051-n-queens", + "csharp":true, + "typescript":true, + "go":true + }, + { + "problem":"N Queens II", + "pattern":"Backtracking", + "link":"n-queens-ii/", + "video":"nalYyLZgvCY", + "difficulty":"Hard", + "code":"0052-n-queens-ii", + "c":true, + "cpp":true, + "javascript":true + }, + { + "problem":"Island Perimeter", + "pattern":"Graphs", + "link":"island-perimeter/", + "video":"fISIuAFRM2s", + "difficulty":"Easy", + "code":"0463-island-perimeter", + "c":true, + "cpp":true, + "csharp":true, + "python":true + }, + { + "problem":"Verifying An Alien Dictionary", + "pattern":"Graphs", + "link":"verifying-an-alien-dictionary/", + "video":"OVgPAJIyX6o", + "difficulty":"Easy", + "code":"0953-verifying-an-alien-dictionary", + "c":true, + "cpp":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Number of Islands", + "pattern":"Graphs", + "link":"number-of-islands/", + "video":"pV2kpPD66nE", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0200-number-of-islands", + "c":true, + "csharp":true, + "typescript":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Clone Graph", + "pattern":"Graphs", + "link":"clone-graph/", + "video":"mQeF6bN8hMk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0133-clone-graph", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true + }, + { + "neetcode150":true, + "problem":"Max Area of Island", + "pattern":"Graphs", + "link":"max-area-of-island/", + "video":"iJGr1OtmH0c", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0695-max-area-of-island", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "problem":"Count Sub Islands", + "pattern":"Graphs", + "link":"count-sub-islands/", + "video":"mLpW3qfbNJ8", + "difficulty":"Medium", + "code":"1905-count-sub-islands", + "c":true, + "csharp":true, + "python":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Pacific Atlantic Water Flow", + "pattern":"Graphs", + "link":"pacific-atlantic-water-flow/", + "video":"s-VkcjHqkGI", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0417-pacific-atlantic-water-flow", + "c":true, + "csharp":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Surrounded Regions", + "pattern":"Graphs", + "link":"surrounded-regions/", + "video":"9z2BunfoZ5Y", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0130-surrounded-regions", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Reorder Routes to Make All Paths Lead to The City Zero", + "pattern":"Graphs", + "link":"reorder-routes-to-make-all-paths-lead-to-the-city-zero/", + "video":"m17yOR5_PpI", + "difficulty":"Medium", + "code":"1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero", + "csharp":true + }, + { + "neetcode150":true, + "problem":"Rotting Oranges", + "pattern":"Graphs", + "link":"rotting-oranges/", + "video":"y704fEOx0s0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0994-rotting-oranges", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Walls And Gates", + "pattern":"Graphs", + "link":"walls-and-gates/", + "video":"e69C6xhiSQE", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0286-walls-and-gates", + "csharp":true + }, + { + "problem":"Snakes And Ladders", + "pattern":"Graphs", + "link":"snakes-and-ladders/", + "video":"6lH4nO3JfLk", + "difficulty":"Medium", + "code":"0909-snakes-and-ladders", + "csharp":true, + "python":true + }, + { + "problem":"Open The Lock", + "pattern":"Graphs", + "link":"open-the-lock/", + "video":"Pzg3bCDY87w", + "difficulty":"Medium", + "code":"0752-open-the-lock", + "csharp":true, + "java":true, + "python":true + }, + { + "problem":"Find Eventual Safe States", + "pattern":"Graphs", + "link":"find-eventual-safe-states/", + "video":"Re_v0j0CRsg", + "difficulty":"Medium", + "code":"0802-find-eventual-safe-states" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Course Schedule", + "pattern":"Graphs", + "link":"course-schedule/", + "video":"EgI5nU9etnU", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0207-course-schedule", + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Course Schedule II", + "pattern":"Graphs", + "link":"course-schedule-ii/", + "video":"Akt3glAwyfY", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0210-course-schedule-ii", + "csharp":true, + "typescript":true + }, + { + "problem":"Check if Move Is Legal", + "pattern":"Graphs", + "link":"check-if-move-is-legal/", + "video":"KxK33AcQZpQ", + "difficulty":"Medium", + "code":"1958-check-if-move-is-legal" + }, + { + "problem":"Shortest Bridge", + "pattern":"Graphs", + "link":"shortest-bridge/", + "video":"gkINMhbbIbU", + "difficulty":"Medium", + "code":"0934-shortest-bridge" + }, + { + "neetcode150":true, + "problem":"Redundant Connection", + "pattern":"Graphs", + "link":"redundant-connection/", + "video":"FXWRE67PLL0", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0684-redundant-connection", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Number of Connected Components In An Undirected Graph", + "premium":true, + "pattern":"Graphs", + "link":"number-of-connected-components-in-an-undirected-graph/", + "video":"8f1XPm4WOUc", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0323-number-of-connected-components-in-an-undirected-graph", + "csharp":true, + "go":true, + "swift":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Graph Valid Tree", + "premium":true, + "pattern":"Graphs", + "link":"graph-valid-tree/", + "video":"bXsUuownnoQ", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0261-graph-valid-tree", + "csharp":true, + "typescript":true, + "swift":true + }, + { + "problem":"Minimum Number of Days to Eat N Oranges", + "pattern":"Graphs", + "link":"minimum-number-of-days-to-eat-n-oranges/", + "video":"LziQ6Qx9sks", + "difficulty":"Hard", + "code":"1553-minimum-number-of-days-to-eat-n-oranges" + }, + { + "neetcode150":true, + "problem":"Word Ladder", + "pattern":"Graphs", + "link":"word-ladder/", + "video":"h9iTnkgv05E", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0127-word-ladder", + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Reconstruct Itinerary", + "pattern":"Advanced Graphs", + "link":"reconstruct-itinerary/", + "video":"ZyB_gQ8vqGA", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0332-reconstruct-itinerary", + "csharp":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Min Cost to Connect All Points", + "pattern":"Advanced Graphs", + "link":"min-cost-to-connect-all-points/", + "video":"f7JOBJIC-NA", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"1584-min-cost-to-connect-all-points", + "csharp":true, + "ruby":true, + "swift":true + }, + { + "neetcode150":true, + "problem":"Network Delay Time", + "pattern":"Advanced Graphs", + "link":"network-delay-time/", + "video":"EaphyqKU4PQ", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0743-network-delay-time", + "csharp":true + }, + { + "neetcode150":true, + "problem":"Swim In Rising Water", + "pattern":"Advanced Graphs", + "link":"swim-in-rising-water/", + "video":"amvrKlMLuGY", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0778-swim-in-rising-water", + "csharp":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Alien Dictionary", + "premium":true, + "pattern":"Advanced Graphs", + "link":"alien-dictionary/", + "video":"6kTZYvNNyps", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0269-alien-dictionary", + "csharp":true + }, + { + "neetcode150":true, + "problem":"Cheapest Flights Within K Stops", + "pattern":"Advanced Graphs", + "link":"cheapest-flights-within-k-stops/", + "video":"5eIK3zUdYmE", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0787-cheapest-flights-within-k-stops", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Climbing Stairs", + "pattern":"1-D Dynamic Programming", + "link":"climbing-stairs/", + "video":"Y0lT9Fck7qI", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0746-min-cost-climbing-stairs", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Min Cost Climbing Stairs", + "pattern":"1-D Dynamic Programming", + "link":"min-cost-climbing-stairs/", + "video":"ktmzAZWkEZ0", + "difficulty":"Easy" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"House Robber", + "pattern":"1-D Dynamic Programming", + "link":"house-robber/", + "video":"73r3KWiEvyk", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0198-house-robber", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"House Robber II", + "pattern":"1-D Dynamic Programming", + "link":"house-robber-ii/", + "video":"rWAJCfYYOvM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0213-house-robber-ii", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Palindromic Substring", + "pattern":"1-D Dynamic Programming", + "link":"longest-palindromic-substring/", + "video":"XYQecbcd6_c", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0005-longest-palindromic-substring", + "c":true, + "csharp":true, + "typescript":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Palindromic Substrings", + "pattern":"1-D Dynamic Programming", + "link":"palindromic-substrings/", + "video":"4RACzI5-du8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0647-palindromic-substrings", + "c":true, + "csharp":true, + "typescript":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Decode Ways", + "pattern":"1-D Dynamic Programming", + "link":"decode-ways/", + "video":"6aEyTjOwlJU", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0091-decode-ways", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Coin Change", + "pattern":"1-D Dynamic Programming", + "link":"coin-change/", + "video":"H9bfqozjoqs", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0322-coin-change", + "c":true, + "csharp":true, + "typescript":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Maximum Product Subarray", + "pattern":"1-D Dynamic Programming", + "link":"maximum-product-subarray/", + "video":"lXVy6YWFcRM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0152-maximum-product-subarray", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Word Break", + "pattern":"1-D Dynamic Programming", + "link":"word-break/", + "video":"Sx9NNgInc3A", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0139-word-break", + "csharp":true, + "typescript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Increasing Subsequence", + "pattern":"1-D Dynamic Programming", + "link":"longest-increasing-subsequence/", + "video":"cjWnW0hdF1Y", + "difficulty":"Medium", + "python":true, + "code":"0673-number-of-longest-increasing-subsequence", + }, + { + "neetcode150":true, + "problem":"Partition Equal Subset Sum", + "pattern":"1-D Dynamic Programming", + "link":"partition-equal-subset-sum/", + "video":"IsvocB5BJhw", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0416-partition-equal-subset-sum", + "csharp":true + }, + { + "problem":"Triangle", + "pattern":"1-D Dynamic Programming", + "link":"triangle/", + "video":"OM1MTokvxs4", + "difficulty":"Medium", + "code":"0120-triangle", + "cpp":true, + "java":true, + "python":true + }, + { + "problem":"Delete And Earn", + "pattern":"1-D Dynamic Programming", + "link":"delete-and-earn/", + "video":"7FCemBxvGw0", + "difficulty":"Medium", + "code":"0740-delete-and-earn" + }, + { + "problem":"Paint House", + "pattern":"1-D Dynamic Programming", + "link":"paint-house/", + "video":"-w67-4tnH5U", + "difficulty":"Medium", + "code":"0256-paint-house" + }, + { + "problem":"Combination Sum IV", + "pattern":"1-D Dynamic Programming", + "link":"combination-sum-iv/", + "video":"dw2nMCxG0ik", + "difficulty":"Medium", + "code":"0377-combination-sum-iv", + "python":true + }, + { + "problem":"Perfect Squares", + "pattern":"1-D Dynamic Programming", + "link":"perfect-squares/", + "video":"HLZLwjzIVGo", + "difficulty":"Medium", + "code":"0279-perfect-squares", + "java":true + }, + { + "problem":"Maximum Subarray Min Product", + "pattern":"1-D Dynamic Programming", + "link":"maximum-subarray-min-product/", + "video":"YLesLbNkyjA", + "difficulty":"Medium", + "code":"1856-maximum-subarray-min-product" + }, + { + "problem":"Minimum Cost For Tickets", + "pattern":"1-D Dynamic Programming", + "link":"minimum-cost-for-tickets/", + "video":"4pY1bsBpIY4", + "difficulty":"Medium", + "code":"0983-minimum-cost-for-tickets" + }, + { + "problem":"Integer Break", + "pattern":"1-D Dynamic Programming", + "link":"integer-break/", + "video":"in6QbUPMJ3I", + "difficulty":"Medium", + "code":"0343-integer-break" + }, + { + "problem":"Number of Longest Increasing Subsequence", + "pattern":"1-D Dynamic Programming", + "link":"number-of-longest-increasing-subsequence/", + "video":"Tuc-rjJbsXU", + "difficulty":"Medium" + }, + { + "problem":"Stickers to Spell Word", + "pattern":"1-D Dynamic Programming", + "link":"stickers-to-spell-word/", + "video":"hsomLb6mUdI", + "difficulty":"Hard", + "code":"0691-stickers-to-spell-word" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Unique Paths", + "pattern":"2-D Dynamic Programming", + "link":"unique-paths/", + "video":"IlEsdxuD4lY", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0062-unique-paths", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Longest Common Subsequence", + "pattern":"2-D Dynamic Programming", + "link":"longest-common-subsequence/", + "video":"Ua0GhsJSlWM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"1143-longest-common-subsequence", + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Best Time to Buy And Sell Stock With Cooldown", + "pattern":"2-D Dynamic Programming", + "link":"best-time-to-buy-and-sell-stock-with-cooldown/", + "video":"I7j0F7AHpb8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0309-best-time-to-buy-and-sell-stock-with-cooldown", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Coin Change II", + "pattern":"2-D Dynamic Programming", + "link":"coin-change-ii/", + "video":"Mjy4hd2xgrs", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0518-coin-change-ii", + "c":true, + "csharp":true, + "typescript":true + }, + { + "neetcode150":true, + "problem":"Target Sum", + "pattern":"2-D Dynamic Programming", + "link":"target-sum/", + "video":"g0npyaQtAQM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0494-target-sum", + "csharp":true, + "typescript":true, + "go":true + }, + { + "neetcode150":true, + "problem":"Interleaving String", + "pattern":"2-D Dynamic Programming", + "link":"interleaving-string/", + "video":"3Rw3p9LrgvE", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0097-interleaving-string", + "csharp":true, + "typescript":true + }, + { + "problem":"Stone Game", + "pattern":"2-D Dynamic Programming", + "link":"stone-game/", + "video":"uhgdXOlGYqE", + "difficulty":"Medium", + "code":"0877-stone-game" + }, + { + "problem":"Minimum Path Sum", + "pattern":"2-D Dynamic Programming", + "link":"minimum-path-sum/", + "video":"pGMsrvt0fpk", + "difficulty":"Medium" + }, + { + "neetcode150":true, + "problem":"Longest Increasing Path In a Matrix", + "pattern":"2-D Dynamic Programming", + "link":"longest-increasing-path-in-a-matrix/", + "video":"wCc_nd-GiEc", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0329-longest-increasing-path-in-a-matrix", + "c":true, + "csharp":true, + "kotlin":true + }, + { + "problem":"Maximal Square", + "pattern":"2-D Dynamic Programming", + "link":"maximal-square/", + "video":"6X7Ha2PrDmM", + "difficulty":"Medium", + "code":"0221-maximal-square", + "python":true + }, + { + "problem":"Maximum Alternating Subsequence Sum", + "pattern":"2-D Dynamic Programming", + "link":"maximum-alternating-subsequence-sum/", + "video":"4v42XOuU1XA", + "difficulty":"Medium", + "code":"5782-maximum-alternating-subsequence-sum" + }, + { + "neetcode150":true, + "problem":"Distinct Subsequences", + "pattern":"2-D Dynamic Programming", + "link":"distinct-subsequences/", + "video":"-RDzMJ33nx8", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0115-distinct-subsequences", + "csharp":true, + "typescript":true + }, + { + "neetcode150":true, + "problem":"Edit Distance", + "pattern":"2-D Dynamic Programming", + "link":"edit-distance/", + "video":"XYi2-LPrwm4", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0072-edit-distance", + "csharp":true, + "swift":true + }, + { + "problem":"Count Vowels Permutation", + "pattern":"2-D Dynamic Programming", + "link":"count-vowels-permutation/", + "video":"VUVpTZVa7Ls", + "difficulty":"Hard", + "code":"1220-count-vowels-permutation", + "python":true + }, + { + "neetcode150":true, + "problem":"Burst Balloons", + "pattern":"2-D Dynamic Programming", + "link":"burst-balloons/", + "video":"VFskby7lUbw", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0312-burst-balloons", + "csharp":true, + "typescript":true + }, + { + "problem":"Number of Ways to Rearrange Sticks With K Sticks Visible", + "pattern":"2-D Dynamic Programming", + "link":"number-of-ways-to-rearrange-sticks-with-k-sticks-visible/", + "video":"O761YBjGxGA", + "difficulty":"Hard", + "code":"1866-number-of-ways-to-rearrange-sticks-with-k-sticks-visible" + }, + { + "neetcode150":true, + "problem":"Regular Expression Matching", + "pattern":"2-D Dynamic Programming", + "link":"regular-expression-matching/", + "video":"HAA8mgxlov8", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0010-regular-expression-matching", + "csharp":true, + "typescript":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Maximum Subarray", + "pattern":"Greedy", + "link":"maximum-subarray/", + "video":"5WZl3MMT0Eg", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0053-maximum-subarray", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Jump Game", + "pattern":"Greedy", + "link":"jump-game/", + "video":"Yan0cv2cLy8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0055-jump-game", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Jump Game II", + "pattern":"Greedy", + "link":"jump-game-ii/", + "video":"dJ7sWiOoK7g", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0045-jump-game-ii", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Jump Game VII", + "pattern":"Greedy", + "link":"jump-game-vii/", + "video":"v1HpZUnQ4Yo", + "difficulty":"Medium", + "code":"1871-jump-game-vii" + }, + { + "neetcode150":true, + "problem":"Gas Station", + "pattern":"Greedy", + "link":"gas-station/", + "video":"lJwbPZGo05A", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0134-gas-station", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Hand of Straights", + "pattern":"Greedy", + "link":"hand-of-straights/", + "video":"amnrMCVd2YI", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0846-hand-of-straights", + "csharp":true, + "typescript":true + }, + { + "problem":"Maximum Points You Can Obtain From Cards", + "pattern":"Greedy", + "link":"maximum-points-you-can-obtain-from-cards/", + "video":"TsA4vbtfCvo", + "difficulty":"Medium", + "code":"1423-maximum-points-you-can-obtain-from-cards", + "csharp":true + }, + { + "neetcode150":true, + "problem":"Merge Triplets to Form Target Triplet", + "pattern":"Greedy", + "link":"merge-triplets-to-form-target-triplet/", + "video":"kShkQLQZ9K4", + "difficulty":"Medium", + "code":"1898-merge-triplets-to-form-target-triplet" + }, + { + "neetcode150":true, + "problem":"Partition Labels", + "pattern":"Greedy", + "link":"partition-labels/", + "video":"B7m8UmZE-vw", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0763-partition-labels", + "csharp":true, + "go":true + }, + { + "neetcode150":true, + "problem":"Valid Parenthesis String", + "pattern":"Greedy", + "link":"valid-parenthesis-string/", + "video":"QhPdNS143Qg", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0678-valid-parenthesis-string", + "c":true, + "csharp":true, + "typescript":true + }, + { + "problem":"Eliminate Maximum Number of Monsters", + "pattern":"Greedy", + "link":"eliminate-maximum-number-of-monsters/", + "video":"6QQRayzOTD4", + "difficulty":"Medium", + "code":"1921-eliminate-maximum-number-of-monsters" + }, + { + "problem":"Two City Scheduling", + "pattern":"Greedy", + "link":"two-city-scheduling/", + "video":"d-B_gk_gJtQ", + "difficulty":"Medium", + "code":"1029-two-city-scheduling" + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Insert Interval", + "pattern":"Intervals", + "link":"insert-interval/", + "video":"A8NUOmlwOlM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0057-insert-interval", + "csharp":true, + "typescript":true, + "swift":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Merge Intervals", + "pattern":"Intervals", + "link":"merge-intervals/", + "video":"44H3cEC2fFM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0056-merge-intervals", + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Non Overlapping Intervals", + "pattern":"Intervals", + "link":"non-overlapping-intervals/", + "video":"nONCGxWoUfM", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0435-non-overlapping-intervals", + "csharp":true, + "typescript":true, + "go":true, + "scala":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Meeting Rooms", + "premium":true, + "pattern":"Intervals", + "link":"meeting-rooms/", + "video":"PaJxqZVPhbg", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0253-meeting-rooms", + "csharp":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Meeting Rooms II", + "premium":true, + "pattern":"Intervals", + "link":"meeting-rooms-ii/", + "video":"FdzJmTCVyJU", + "difficulty":"Medium", + "python":true, + "code":"0919-meeting-rooms-ii" + }, + { + "problem":"Remove Covered Intervals", + "pattern":"Intervals", + "link":"remove-covered-intervals/", + "video":"nhAsMabiVkM", + "difficulty":"Medium", + "code":"1288-remove-covered-intervals", + "c":true + }, + { + "neetcode150":true, + "problem":"Minimum Interval to Include Each Query", + "pattern":"Intervals", + "link":"minimum-interval-to-include-each-query/", + "video":"5hQ5WWW5awQ", + "difficulty":"Hard", + "python":true, + "java":true, + "cpp":true, + "code":"1851-minimum-interval-to-include-each-query", + "csharp":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Rotate Image", + "pattern":"Math & Geometry", + "link":"rotate-image/", + "video":"fMSJSS7eO1w", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0048-rotate-image", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Spiral Matrix", + "pattern":"Math & Geometry", + "link":"spiral-matrix/", + "video":"BJnMZNwUk1M", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0054-spiral-matrix", + "csharp":true, + "typescript":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Set Matrix Zeroes", + "pattern":"Math & Geometry", + "link":"set-matrix-zeroes/", + "video":"T41rL0L3Pnw", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0073-set-matrix-zeroes", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Happy Number", + "pattern":"Math & Geometry", + "link":"happy-number/", + "video":"ljz85bxOYJ0", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0202-happy-number", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "problem":"Plus One", + "pattern":"Math & Geometry", + "link":"plus-one/", + "video":"jIaA8boiG1s", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0066-plus-one", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "swift":true, + "kotlin":true + }, + { + "problem":"Palindrome Number", + "pattern":"Math & Geometry", + "link":"palindrome-number/", + "video":"yubRKwixN-U", + "difficulty":"Easy", + "code":"0009-palindrome-number", + "javascript":true, + "typescript":true + }, + { + "problem":"Ugly Number", + "pattern":"Math & Geometry", + "link":"ugly-number/", + "video":"M0Zay1Qr9ws", + "difficulty":"Easy", + "code":"0263-ugly-number", + "c":true + }, + { + "problem":"Shift 2D Grid", + "pattern":"Math & Geometry", + "link":"shift-2d-grid/", + "video":"nJYFh4Dl-as", + "difficulty":"Easy", + "code":"1260-shift-2d-grid" + }, + { + "problem":"Roman to Integer", + "pattern":"Math & Geometry", + "link":"roman-to-integer/", + "video":"3jdxYj3DD98", + "difficulty":"Easy", + "code":"0013-roman-to-integer", + "python":true, + "javascript":true, + "go":true + }, + { + "problem":"Integer to Roman", + "pattern":"Math & Geometry", + "link":"integer-to-roman/", + "video":"ohBNdSJyLh8", + "difficulty":"Medium", + "code":"0012-integer-to-roman", + "python":true + }, + { + "neetcode150":true, + "problem":"Pow(x, n)", + "pattern":"Math & Geometry", + "link":"powx-n/", + "video":"g9YQyYi4IQQ", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "code":"0050-powx-n", + "c":true, + "csharp":true, + "typescript":true, + "swift":true + }, + { + "neetcode150":true, + "problem":"Multiply Strings", + "pattern":"Math & Geometry", + "link":"multiply-strings/", + "video":"1vZswirL8Y8", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0043-multiply-strings", + "csharp":true, + "typescript":true, + "swift":true + }, + { + "neetcode150":true, + "problem":"Detect Squares", + "pattern":"Math & Geometry", + "link":"detect-squares/", + "video":"bahebearrDc", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"2013-detect-squares", + "csharp":true + }, + { + "problem":"Robot Bounded In Circle", + "pattern":"Math & Geometry", + "link":"robot-bounded-in-circle/", + "video":"nKv2LnC_g6E", + "difficulty":"Medium", + "code":"1041-robot-bounded-in-circle" + }, + { + "problem":"Zigzag Conversion", + "pattern":"Math & Geometry", + "link":"zigzag-conversion/", + "video":"Q2Tw6gcVEwc", + "difficulty":"Medium", + "code":"0006-zigzag-conversion", + "java":true + }, + { + "problem":"Find Missing Observations", + "pattern":"Math & Geometry", + "link":"find-missing-observations/", + "video":"86yKkaNi3sU", + "difficulty":"Medium", + "code":"2028-find-missing-observations" + }, + { + "neetcode150":true, + "problem":"Single Number", + "pattern":"Bit Manipulation", + "link":"single-number/", + "video":"qMPX1AOa83k", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0136-single-number", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Number of 1 Bits", + "pattern":"Bit Manipulation", + "link":"number-of-1-bits/", + "video":"5Km3utixwZs", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0191-number-of-1-bits", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Counting Bits", + "pattern":"Bit Manipulation", + "link":"counting-bits/", + "video":"RyBM56RIWrM", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0338-counting-bits", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Reverse Bits", + "pattern":"Bit Manipulation", + "link":"reverse-bits/", + "video":"UcoN6UjAI64", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0190-reverse-bits", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Missing Number", + "pattern":"Bit Manipulation", + "link":"missing-number/", + "video":"WnPLSRLSANE", + "difficulty":"Easy", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0268-missing-number", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "blind75":true, + "problem":"Sum of Two Integers", + "pattern":"Bit Manipulation", + "link":"sum-of-two-integers/", + "video":"gVUrDV4tZfY", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0371-sum-of-two-integers", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "rust":true + }, + { + "neetcode150":true, + "problem":"Reverse Integer", + "pattern":"Bit Manipulation", + "link":"reverse-integer/", + "video":"HAgLH58IgJQ", + "difficulty":"Medium", + "python":true, + "java":true, + "cpp":true, + "javascript":true, + "code":"0007-reverse-integer", + "c":true, + "csharp":true, + "typescript":true, + "go":true, + "ruby":true, + "swift":true, + "kotlin":true, + "scala":true + }, + { + "problem":"Add Binary", + "pattern":"Bit Manipulation", + "link":"add-binary/", + "video":"keuWJ47xG8g", + "difficulty":"Easy", + "code":"0067-add-binary" + } +] \ No newline at end of file diff --git a/c/1-Two-Sum.c b/c/0001-two-sum.c similarity index 100% rename from c/1-Two-Sum.c rename to c/0001-two-sum.c diff --git a/c/2-Add-Two-Numbers.c b/c/0002-add-two-numbers.c similarity index 100% rename from c/2-Add-Two-Numbers.c rename to c/0002-add-two-numbers.c diff --git a/c/3-Longest-Substring-Without-Repeating-Characters.c b/c/0003-longest-substring-without-repeating-characters.c similarity index 100% rename from c/3-Longest-Substring-Without-Repeating-Characters.c rename to c/0003-longest-substring-without-repeating-characters.c diff --git a/c/4-Median-of-Two-Sorted-Arrays.c b/c/0004-median-of-two-sorted-arrays.c similarity index 100% rename from c/4-Median-of-Two-Sorted-Arrays.c rename to c/0004-median-of-two-sorted-arrays.c diff --git a/c/5-Longest-Palindromic-Substring.c b/c/0005-longest-palindromic-substring.c similarity index 100% rename from c/5-Longest-Palindromic-Substring.c rename to c/0005-longest-palindromic-substring.c diff --git a/c/7-Reverse-Integer.c b/c/0007-reverse-integer.c similarity index 100% rename from c/7-Reverse-Integer.c rename to c/0007-reverse-integer.c diff --git a/c/11-Container-With-Most-Water.c b/c/0011-container-with-most-water.c similarity index 100% rename from c/11-Container-With-Most-Water.c rename to c/0011-container-with-most-water.c diff --git a/c/19-Remove-Nth-Node-From-End-of-List.c b/c/0019-remove-nth-node-from-end-of-list.c similarity index 100% rename from c/19-Remove-Nth-Node-From-End-of-List.c rename to c/0019-remove-nth-node-from-end-of-list.c diff --git a/c/20-Valid-Parentheses.c b/c/0020-valid-parentheses.c similarity index 100% rename from c/20-Valid-Parentheses.c rename to c/0020-valid-parentheses.c diff --git a/c/21-Merge-Two-Sorted-Lists.c b/c/0021-merge-two-sorted-lists.c similarity index 100% rename from c/21-Merge-Two-Sorted-Lists.c rename to c/0021-merge-two-sorted-lists.c diff --git a/c/23-Merge-K-Sorted-Lists.c b/c/0023-merge-k-sorted-lists.c similarity index 100% rename from c/23-Merge-K-Sorted-Lists.c rename to c/0023-merge-k-sorted-lists.c diff --git a/c/25-Reverse-Nodes-in-k-Group.c b/c/0025-reverse-nodes-in-k-group.c similarity index 100% rename from c/25-Reverse-Nodes-in-k-Group.c rename to c/0025-reverse-nodes-in-k-group.c diff --git a/c/27-Remove-Element.c b/c/0027-remove-element.c similarity index 100% rename from c/27-Remove-Element.c rename to c/0027-remove-element.c diff --git a/c/33-Search-in-Rotated-Sorted-Array.c b/c/0033-search-in-rotated-sorted-array.c similarity index 100% rename from c/33-Search-in-Rotated-Sorted-Array.c rename to c/0033-search-in-rotated-sorted-array.c diff --git a/c/35-Search-Insert-Position.c b/c/0035-search-insert-position.c similarity index 100% rename from c/35-Search-Insert-Position.c rename to c/0035-search-insert-position.c diff --git a/c/36-Valid-Sudoku.c b/c/0036-valid-sudoku.c similarity index 100% rename from c/36-Valid-Sudoku.c rename to c/0036-valid-sudoku.c diff --git a/c/42-Trapping-Rain-Water.c b/c/0042-trapping-rain-water.c similarity index 100% rename from c/42-Trapping-Rain-Water.c rename to c/0042-trapping-rain-water.c diff --git a/c/45-Jump-Game-II.c b/c/0045-jump-game-ii.c similarity index 100% rename from c/45-Jump-Game-II.c rename to c/0045-jump-game-ii.c diff --git a/c/48-Rotate-Image.c b/c/0048-rotate-image.c similarity index 100% rename from c/48-Rotate-Image.c rename to c/0048-rotate-image.c diff --git a/c/50-Pow-X-N.c b/c/0050-powx-n.c similarity index 100% rename from c/50-Pow-X-N.c rename to c/0050-powx-n.c diff --git a/c/52-N-Queens-II.c b/c/0052-n-queens-ii.c similarity index 100% rename from c/52-N-Queens-II.c rename to c/0052-n-queens-ii.c diff --git a/c/53-Maximum-Subarray.c b/c/0053-maximum-subarray.c similarity index 100% rename from c/53-Maximum-Subarray.c rename to c/0053-maximum-subarray.c diff --git a/c/55-Jump-Game.c b/c/0055-jump-game.c similarity index 100% rename from c/55-Jump-Game.c rename to c/0055-jump-game.c diff --git a/c/58-Length-Of-Last-Word.c b/c/0058-length-of-last-word.c similarity index 100% rename from c/58-Length-Of-Last-Word.c rename to c/0058-length-of-last-word.c diff --git a/c/62-Unique-Paths.c b/c/0062-unique-paths.c similarity index 100% rename from c/62-Unique-Paths.c rename to c/0062-unique-paths.c diff --git a/c/66-Plus-One.c b/c/0066-plus-one.c similarity index 100% rename from c/66-Plus-One.c rename to c/0066-plus-one.c diff --git a/c/70-Climbing-Stairs.c b/c/0070-climbing-stairs.c similarity index 100% rename from c/70-Climbing-Stairs.c rename to c/0070-climbing-stairs.c diff --git a/c/73-Set-Matrix-Zeroes.c b/c/0073-set-matrix-zeroes.c similarity index 100% rename from c/73-Set-Matrix-Zeroes.c rename to c/0073-set-matrix-zeroes.c diff --git a/c/74-Search-A-2D-Matrix.c b/c/0074-search-a-2d-matrix.c similarity index 100% rename from c/74-Search-A-2D-Matrix.c rename to c/0074-search-a-2d-matrix.c diff --git a/c/75-Sort-Colors.c b/c/0075-sort-colors.c similarity index 100% rename from c/75-Sort-Colors.c rename to c/0075-sort-colors.c diff --git a/c/76-Minimum-Window-Substring.c b/c/0076-minimum-window-substring.c similarity index 100% rename from c/76-Minimum-Window-Substring.c rename to c/0076-minimum-window-substring.c diff --git a/c/78-Subsets.c b/c/0078-subsets.c similarity index 100% rename from c/78-Subsets.c rename to c/0078-subsets.c diff --git a/c/79-Word-Search.c b/c/0079-word-search.c similarity index 100% rename from c/79-Word-Search.c rename to c/0079-word-search.c diff --git a/c/88-Merge-Sorted-Array.c b/c/0088-merge-sorted-array.c similarity index 100% rename from c/88-Merge-Sorted-Array.c rename to c/0088-merge-sorted-array.c diff --git a/c/91-Decode-Ways.c b/c/0091-decode-ways.c similarity index 100% rename from c/91-Decode-Ways.c rename to c/0091-decode-ways.c diff --git a/c/94-Binary-Tree-Inorder-Traversal.c b/c/0094-binary-tree-inorder-traversal.c similarity index 100% rename from c/94-Binary-Tree-Inorder-Traversal.c rename to c/0094-binary-tree-inorder-traversal.c diff --git a/c/96-Unique-Binary-Search-Tree.c b/c/0096-unique-binary-search-trees.c similarity index 100% rename from c/96-Unique-Binary-Search-Tree.c rename to c/0096-unique-binary-search-trees.c diff --git a/c/98-Validate-Binary-Search-Tree.c b/c/0098-validate-binary-search-tree.c similarity index 100% rename from c/98-Validate-Binary-Search-Tree.c rename to c/0098-validate-binary-search-tree.c diff --git a/c/100-Same-Tree.c b/c/0100-same-tree.c similarity index 100% rename from c/100-Same-Tree.c rename to c/0100-same-tree.c diff --git a/c/102-Binary-Tree-Level-Order-Traversal.c b/c/0102-binary-tree-level-order-traversal.c similarity index 100% rename from c/102-Binary-Tree-Level-Order-Traversal.c rename to c/0102-binary-tree-level-order-traversal.c diff --git a/c/104-Maximum-Depth-Of-Binary-Tree.c b/c/0104-maximum-depth-of-binary-tree.c similarity index 100% rename from c/104-Maximum-Depth-Of-Binary-Tree.c rename to c/0104-maximum-depth-of-binary-tree.c diff --git a/c/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.c b/c/0105-construct-binary-tree-from-preorder-and-inorder-traversal.c similarity index 100% rename from c/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.c rename to c/0105-construct-binary-tree-from-preorder-and-inorder-traversal.c diff --git a/c/108-Convert-Sorted-Array.c b/c/0108-convert-sorted-array-to-binary-search-tree.c similarity index 100% rename from c/108-Convert-Sorted-Array.c rename to c/0108-convert-sorted-array-to-binary-search-tree.c diff --git a/c/110-Balanced-Binary-Tree.c b/c/0110-balanced-binary-tree.c similarity index 100% rename from c/110-Balanced-Binary-Tree.c rename to c/0110-balanced-binary-tree.c diff --git a/c/112-Path-Sum.c b/c/0112-path-sum.c similarity index 100% rename from c/112-Path-Sum.c rename to c/0112-path-sum.c diff --git a/c/118-Pascals-Triangle.c b/c/0118-pascals-triangle.c similarity index 100% rename from c/118-Pascals-Triangle.c rename to c/0118-pascals-triangle.c diff --git a/c/121-Best-Time-To-Buy-And-Sell-Stock.c b/c/0121-best-time-to-buy-and-sell-stock.c similarity index 100% rename from c/121-Best-Time-To-Buy-And-Sell-Stock.c rename to c/0121-best-time-to-buy-and-sell-stock.c diff --git a/c/122-Best-Time-to-Buy-and-Sell-Stock-II.c b/c/0122-best-time-to-buy-and-sell-stock-ii.c similarity index 100% rename from c/122-Best-Time-to-Buy-and-Sell-Stock-II.c rename to c/0122-best-time-to-buy-and-sell-stock-ii.c diff --git a/c/124-Binary-Tree-Maximum-Path-Sum.c b/c/0124-binary-tree-maximum-path-sum.c similarity index 100% rename from c/124-Binary-Tree-Maximum-Path-Sum.c rename to c/0124-binary-tree-maximum-path-sum.c diff --git a/c/125-Valid-Palindrome.c b/c/0125-valid-palindrome.c similarity index 100% rename from c/125-Valid-Palindrome.c rename to c/0125-valid-palindrome.c diff --git a/c/129-Sum-Root-To-Leaf.c b/c/0129-sum-root-to-leaf-numbers.c similarity index 100% rename from c/129-Sum-Root-To-Leaf.c rename to c/0129-sum-root-to-leaf-numbers.c diff --git a/c/130-Surrounded-Regions.c b/c/0130-surrounded-regions.c similarity index 100% rename from c/130-Surrounded-Regions.c rename to c/0130-surrounded-regions.c diff --git a/c/133-Clone-Graph.c b/c/0133-clone-graph.c similarity index 100% rename from c/133-Clone-Graph.c rename to c/0133-clone-graph.c diff --git a/c/134-Gas-Station.c b/c/0134-gas-station.c similarity index 100% rename from c/134-Gas-Station.c rename to c/0134-gas-station.c diff --git a/c/136-Single-Number.c b/c/0136-single-number.c similarity index 100% rename from c/136-Single-Number.c rename to c/0136-single-number.c diff --git a/c/138-Copy-List-with-Random-Pointer.c b/c/0138-copy-list-with-random-pointer.c similarity index 100% rename from c/138-Copy-List-with-Random-Pointer.c rename to c/0138-copy-list-with-random-pointer.c diff --git a/c/141-Linked-List-Cycle.c b/c/0141-linked-list-cycle.c similarity index 100% rename from c/141-Linked-List-Cycle.c rename to c/0141-linked-list-cycle.c diff --git a/c/143-Reorder-List.c b/c/0143-reorder-list.c similarity index 100% rename from c/143-Reorder-List.c rename to c/0143-reorder-list.c diff --git a/c/146-LRU-Cache.c b/c/0146-lru-cache.c similarity index 100% rename from c/146-LRU-Cache.c rename to c/0146-lru-cache.c diff --git a/c/150-Evaluate-Reverse-Polish-Notation.c b/c/0150-evaluate-reverse-polish-notation.c similarity index 100% rename from c/150-Evaluate-Reverse-Polish-Notation.c rename to c/0150-evaluate-reverse-polish-notation.c diff --git a/c/152-Maximum-Product-Subarray.c b/c/0152-maximum-product-subarray.c similarity index 100% rename from c/152-Maximum-Product-Subarray.c rename to c/0152-maximum-product-subarray.c diff --git a/c/153-Find-Minimum-in-Rotated-Sorted-Array.c b/c/0153-find-minimum-in-rotated-sorted-array.c similarity index 100% rename from c/153-Find-Minimum-in-Rotated-Sorted-Array.c rename to c/0153-find-minimum-in-rotated-sorted-array.c diff --git a/c/167-Two-Sum-II.c b/c/0167-two-sum-ii-input-array-is-sorted.c similarity index 100% rename from c/167-Two-Sum-II.c rename to c/0167-two-sum-ii-input-array-is-sorted.c diff --git a/c/169-Majority-Element.c b/c/0169-majority-element.c similarity index 100% rename from c/169-Majority-Element.c rename to c/0169-majority-element.c diff --git a/c/190-Reverse-Bits.c b/c/0190-reverse-bits.c similarity index 100% rename from c/190-Reverse-Bits.c rename to c/0190-reverse-bits.c diff --git a/c/191-Number-of-1-Bits.c b/c/0191-number-of-1-bits.c similarity index 100% rename from c/191-Number-of-1-Bits.c rename to c/0191-number-of-1-bits.c diff --git a/c/198-House-Robber.c b/c/0198-house-robber.c similarity index 100% rename from c/198-House-Robber.c rename to c/0198-house-robber.c diff --git a/c/199-Binary-Tree-Right-Side-View.c b/c/0199-binary-tree-right-side-view.c similarity index 100% rename from c/199-Binary-Tree-Right-Side-View.c rename to c/0199-binary-tree-right-side-view.c diff --git a/c/200-Number-Of-Islands.c b/c/0200-number-of-islands.c similarity index 100% rename from c/200-Number-Of-Islands.c rename to c/0200-number-of-islands.c diff --git a/c/202-Happy-Number.c b/c/0202-happy-number.c similarity index 100% rename from c/202-Happy-Number.c rename to c/0202-happy-number.c diff --git a/c/205-Isomorphic-Strings.c b/c/0205-isomorphic-strings.c similarity index 100% rename from c/205-Isomorphic-Strings.c rename to c/0205-isomorphic-strings.c diff --git a/c/206-Reverse-Linked-List.c b/c/0206-reverse-linked-list.c similarity index 100% rename from c/206-Reverse-Linked-List.c rename to c/0206-reverse-linked-list.c diff --git a/c/208-Implement-Trie-Prefix-Tree.c b/c/0208-implement-trie-prefix-tree.c similarity index 100% rename from c/208-Implement-Trie-Prefix-Tree.c rename to c/0208-implement-trie-prefix-tree.c diff --git a/c/209-Minimum-Size-Subarray-Sum.c b/c/0209-minimum-size-subarray-sum.c similarity index 100% rename from c/209-Minimum-Size-Subarray-Sum.c rename to c/0209-minimum-size-subarray-sum.c diff --git a/c/213-House-Robber-II.c b/c/0213-house-robber-ii.c similarity index 100% rename from c/213-House-Robber-II.c rename to c/0213-house-robber-ii.c diff --git a/c/217-Contains-Duplicate.c b/c/0217-contains-duplicate.c similarity index 100% rename from c/217-Contains-Duplicate.c rename to c/0217-contains-duplicate.c diff --git a/c/226-Invert-Binary-Tree.c b/c/0226-invert-binary-tree.c similarity index 100% rename from c/226-Invert-Binary-Tree.c rename to c/0226-invert-binary-tree.c diff --git a/c/230-Kth-Smallest-Element-In-BST.c b/c/0230-kth-smallest-element-in-a-bst.c similarity index 100% rename from c/230-Kth-Smallest-Element-In-BST.c rename to c/0230-kth-smallest-element-in-a-bst.c diff --git a/c/235-Lowest-Common-Ancestor-Of-A-Binary-Search-Tree.c b/c/0235-lowest-common-ancestor-of-a-binary-search-tree.c similarity index 100% rename from c/235-Lowest-Common-Ancestor-Of-A-Binary-Search-Tree.c rename to c/0235-lowest-common-ancestor-of-a-binary-search-tree.c diff --git a/c/238-Product-of-Array-Except-Self.c b/c/0238-product-of-array-except-self.c similarity index 100% rename from c/238-Product-of-Array-Except-Self.c rename to c/0238-product-of-array-except-self.c diff --git a/c/242-Valid-Anagram.c b/c/0242-valid-anagram.c similarity index 100% rename from c/242-Valid-Anagram.c rename to c/0242-valid-anagram.c diff --git a/c/263-Ugly-Number.c b/c/0263-ugly-number.c similarity index 100% rename from c/263-Ugly-Number.c rename to c/0263-ugly-number.c diff --git a/c/268-Missing-Number.c b/c/0268-missing-number.c similarity index 100% rename from c/268-Missing-Number.c rename to c/0268-missing-number.c diff --git a/c/283-Move-Zeroes.c b/c/0283-move-zeroes.c similarity index 100% rename from c/283-Move-Zeroes.c rename to c/0283-move-zeroes.c diff --git a/c/287-Find-The-Duplicate-Number.c b/c/0287-find-the-duplicate-number.c similarity index 100% rename from c/287-Find-The-Duplicate-Number.c rename to c/0287-find-the-duplicate-number.c diff --git a/c/297-Serialize-and-Deserialize-Binary-Tree.c b/c/0297-serialize-and-deserialize-binary-tree.c similarity index 100% rename from c/297-Serialize-and-Deserialize-Binary-Tree.c rename to c/0297-serialize-and-deserialize-binary-tree.c diff --git a/c/300-Longest-Increasing-Subsequence.c b/c/0300-longest-increasing-subsequence.c similarity index 100% rename from c/300-Longest-Increasing-Subsequence.c rename to c/0300-longest-increasing-subsequence.c diff --git a/c/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.c b/c/0309-best-time-to-buy-and-sell-stock-with-cooldown.c similarity index 100% rename from c/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.c rename to c/0309-best-time-to-buy-and-sell-stock-with-cooldown.c diff --git a/c/322-Coin-Change.c b/c/0322-coin-change.c similarity index 100% rename from c/322-Coin-Change.c rename to c/0322-coin-change.c diff --git a/c/329-Longest-Increasing-Path-in-a-Matrix.c b/c/0329-longest-increasing-path-in-a-matrix.c similarity index 100% rename from c/329-Longest-Increasing-Path-in-a-Matrix.c rename to c/0329-longest-increasing-path-in-a-matrix.c diff --git a/c/338-Counting-Bits.c b/c/0338-counting-bits.c similarity index 100% rename from c/338-Counting-Bits.c rename to c/0338-counting-bits.c diff --git a/c/344-Reverse-String.c b/c/0344-reverse-string.c similarity index 100% rename from c/344-Reverse-String.c rename to c/0344-reverse-string.c diff --git a/c/371-Sum-of-Two-Integers.c b/c/0371-sum-of-two-integers.c similarity index 100% rename from c/371-Sum-of-Two-Integers.c rename to c/0371-sum-of-two-integers.c diff --git a/c/374-Guess-Number-Higher-Or-Lower.c b/c/0374-guess-number-higher-or-lower.c similarity index 100% rename from c/374-Guess-Number-Higher-Or-Lower.c rename to c/0374-guess-number-higher-or-lower.c diff --git a/c/392-Is-Subsequence.c b/c/0392-is-subsequence.c similarity index 100% rename from c/392-Is-Subsequence.c rename to c/0392-is-subsequence.c diff --git a/c/417-Pacific-Atlantic-Waterflow.c b/c/0417-pacific-atlantic-water-flow.c similarity index 100% rename from c/417-Pacific-Atlantic-Waterflow.c rename to c/0417-pacific-atlantic-water-flow.c diff --git a/c/424-Longest-Repeating-Character-Replacement.c b/c/0424-longest-repeating-character-replacement.c similarity index 100% rename from c/424-Longest-Repeating-Character-Replacement.c rename to c/0424-longest-repeating-character-replacement.c diff --git a/c/463-Island-Perimeter.c b/c/0463-island-perimeter.c similarity index 100% rename from c/463-Island-Perimeter.c rename to c/0463-island-perimeter.c diff --git a/c/518-Coin-Change-II.c b/c/0518-coin-change-ii.c similarity index 100% rename from c/518-Coin-Change-II.c rename to c/0518-coin-change-ii.c diff --git a/c/543-Diameter-Of-Binary-Tree.c b/c/0543-diameter-of-binary-tree.c similarity index 100% rename from c/543-Diameter-Of-Binary-Tree.c rename to c/0543-diameter-of-binary-tree.c diff --git a/c/567-Permutation-in-String.c b/c/0567-permutation-in-string.c similarity index 100% rename from c/567-Permutation-in-String.c rename to c/0567-permutation-in-string.c diff --git a/c/572-Subtree-Of-Another-Tree.c b/c/0572-subtree-of-another-tree.c similarity index 100% rename from c/572-Subtree-Of-Another-Tree.c rename to c/0572-subtree-of-another-tree.c diff --git a/c/605-Can-Place-Flowers.c b/c/0605-can-place-flowers.c similarity index 100% rename from c/605-Can-Place-Flowers.c rename to c/0605-can-place-flowers.c diff --git a/c/617-Merge-Two-Binary-Trees.c b/c/0617-merge-two-binary-trees.c similarity index 100% rename from c/617-Merge-Two-Binary-Trees.c rename to c/0617-merge-two-binary-trees.c diff --git a/c/647-Palindromic-Substrings.c b/c/0647-palindromic-substrings.c similarity index 100% rename from c/647-Palindromic-Substrings.c rename to c/0647-palindromic-substrings.c diff --git a/c/678-Valid-Parenthesis-String.c b/c/0678-valid-parenthesis-string.c similarity index 100% rename from c/678-Valid-Parenthesis-String.c rename to c/0678-valid-parenthesis-string.c diff --git a/c/682-Baseball-Game.c b/c/0682-baseball-game.c similarity index 100% rename from c/682-Baseball-Game.c rename to c/0682-baseball-game.c diff --git a/c/684-Redundant-Connection.c b/c/0684-redundant-connection.c similarity index 100% rename from c/684-Redundant-Connection.c rename to c/0684-redundant-connection.c diff --git a/c/695-Max-Area-of-Island.c b/c/0695-max-area-of-island.c similarity index 100% rename from c/695-Max-Area-of-Island.c rename to c/0695-max-area-of-island.c diff --git a/c/703-Kth-Largest-Element-In-A-Stream.c b/c/0703-kth-largest-element-in-a-stream.c similarity index 100% rename from c/703-Kth-Largest-Element-In-A-Stream.c rename to c/0703-kth-largest-element-in-a-stream.c diff --git a/c/704-Binary-Search.c b/c/0704-binary-search.c similarity index 100% rename from c/704-Binary-Search.c rename to c/0704-binary-search.c diff --git a/c/724-Find-Pivot-Index.c b/c/0724-find-pivot-index.c similarity index 100% rename from c/724-Find-Pivot-Index.c rename to c/0724-find-pivot-index.c diff --git a/c/739-Daily-Temperatures.c b/c/0739-daily-temperatures.c similarity index 100% rename from c/739-Daily-Temperatures.c rename to c/0739-daily-temperatures.c diff --git a/c/746-Min-Cost-Climbing-Stairs.c b/c/0746-min-cost-climbing-stairs.c similarity index 100% rename from c/746-Min-Cost-Climbing-Stairs.c rename to c/0746-min-cost-climbing-stairs.c diff --git a/c/875-Koko-Eating-Bananas.c b/c/0875-koko-eating-bananas.c similarity index 100% rename from c/875-Koko-Eating-Bananas.c rename to c/0875-koko-eating-bananas.c diff --git a/c/881-Boats-To-Save-People.c b/c/0881-boats-to-save-people.c similarity index 100% rename from c/881-Boats-To-Save-People.c rename to c/0881-boats-to-save-people.c diff --git a/c/953-Verifying-An-Alien-Dictionary.c b/c/0953-verifying-an-alien-dictionary.c similarity index 100% rename from c/953-Verifying-An-Alien-Dictionary.c rename to c/0953-verifying-an-alien-dictionary.c diff --git a/c/994-Rotting-Oranges.c b/c/0994-rotting-oranges.c similarity index 100% rename from c/994-Rotting-Oranges.c rename to c/0994-rotting-oranges.c diff --git a/c/1189-maximum-number-of-balloons.c b/c/1189-maximum-number-of-balloons.c new file mode 100644 index 000000000..14770d81c --- /dev/null +++ b/c/1189-maximum-number-of-balloons.c @@ -0,0 +1,36 @@ +/* +Given a string text, you want to use the characters of text to form as many instances of the word "balloon" as possible. + +Space: O(1) +Time: O(n) +*/ + + +int min(int a, int b) { + return ab[1] ) + qsort(intervals, intervalsSize, sizeof(int*), cmp_fun); + + // Treatment of intervals sorted + int end = 0; + int number_remaining = intervalsSize; + for (int i=0; ib?a:b; +} + +int* replaceElements(int* arr, int arrSize, int* returnSize){ + int greatest = -1; + *returnSize = arrSize; + for (int i=arrSize-1; i>=0; i--) { + int m = greatest; + greatest = max(greatest, arr[i]); + arr[i] = m; + } + return arr; +} diff --git a/c/1448-count-good-nodes-in-binary-tree.c b/c/1448-count-good-nodes-in-binary-tree.c new file mode 100644 index 000000000..8d6cd8a03 --- /dev/null +++ b/c/1448-count-good-nodes-in-binary-tree.c @@ -0,0 +1,18 @@ +/* +Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. +Return the number of good nodes in the binary tree. +Time: O(n) +Space: O(log(h)) Where h is the height of the tree +*/ + +int nbGood(struct TreeNode* root, int m) { + if (root==NULL) + return 0; + if (root->val >= m) + return 1+nbGood(root->left, root->val)+nbGood(root->right, root->val); + return nbGood(root->left, m)+nbGood(root->right, m); +} + +int goodNodes(struct TreeNode* root){ + return nbGood(root, INT_MIN); +} diff --git a/c/1905-count-sub-islands.c b/c/1905-count-sub-islands.c new file mode 100644 index 000000000..c0da237c0 --- /dev/null +++ b/c/1905-count-sub-islands.c @@ -0,0 +1,35 @@ +/* + +Space: O(n²) (due to recursives calls) +Time: O(n²) +*/ + +bool dfs_test(int** grid1, int** grid2, int i, int j, int n, int m) { + // Test if the island in grid2 is entirely in grid1 and delete the island in grid2 + bool ans = (grid1[i][j] == 1); + grid2[i][j] = 0; + if (i>0 && grid2[i-1][j]==1) + ans = dfs_test(grid1, grid2, i-1, j, n ,m) && ans; + if (j>0 && grid2[i][j-1]==1) + ans = dfs_test(grid1, grid2, i, j-1, n ,m) && ans; + if (i<(n-1) && grid2[i+1][j]==1) + ans = dfs_test(grid1, grid2, i+1, j, n ,m) && ans; + if (j<(m-1) && grid2[i][j+1]==1) + ans = dfs_test(grid1, grid2, i, j+1, n ,m) && ans; + return ans; +} + +int countSubIslands(int** grid1, int grid1Size, int* grid1ColSize, int** grid2, int grid2Size, int* grid2ColSize){ + int cpt=0; + for (int i=0; i 1, [2,4,1,1,1], [2,1,1,1], [1,1,1], [1] + + Max heap, pop 2 biggest, push back difference until no more 2 elements left + + Time: O(n log n) + Space: O(n) +*/ + +class Solution { +public: + int lastStoneWeight(vector& stones) { + priority_queue pq; + for (int i = 0; i < stones.size(); i++) { + pq.push(stones[i]); + } + + while (pq.size() > 1) { + int y = pq.top(); + pq.pop(); + int x = pq.top(); + pq.pop(); + if (y > x) { + pq.push(y - x); + } + } + + if (pq.empty()) { + return 0; + } + return pq.top(); + } +}; diff --git a/cpp/1143-longest-common-subsequence.cpp b/cpp/1143-longest-common-subsequence.cpp new file mode 100644 index 000000000..43cbe1947 --- /dev/null +++ b/cpp/1143-longest-common-subsequence.cpp @@ -0,0 +1,37 @@ +/* + Given 2 strings, return length of longest common subsequence + Ex. text1 = "abcde", text2 = "ace" -> 3, "ace" is LCS + + j + a c e + a 3 + b 2 --> visualization of below, build DP bottom-up + i c 2 + d 1 + e 1 + + Time: O(m x n) + Space: O(m x n) +*/ + +class Solution { +public: + int longestCommonSubsequence(string text1, string text2) { + int m = text1.size(); + int n = text2.size(); + + vector> dp(m + 1, vector(n + 1)); + + for (int i = m - 1; i >= 0; i--) { + for (int j = n - 1; j >= 0; j--) { + if (text1[i] == text2[j]) { + dp[i][j] = 1 + dp[i + 1][j + 1]; + } else { + dp[i][j] = max(dp[i + 1][j], dp[i][j + 1]); + } + } + } + + return dp[0][0]; + } +}; diff --git a/cpp/1209-remove-all-adjacent-duplicates-in-string-ii.cpp b/cpp/1209-remove-all-adjacent-duplicates-in-string-ii.cpp new file mode 100644 index 000000000..26afe7e18 --- /dev/null +++ b/cpp/1209-remove-all-adjacent-duplicates-in-string-ii.cpp @@ -0,0 +1,39 @@ +// Time and space complexity is O(n) where n is the size of the input string. +class Solution { +public: + string removeDuplicates(string s, int k) { + stack> st; + + for(int i = 0 ; i < s.size(); i++) + { + int count = 1; + if(!st.empty() && st.top().first == s[i]) + { + count += st.top().second; + st.pop(); + } + + st.push({s[i] , count}); + + if(count == k) st.pop(); + + } + + string ans = ""; + while(!st.empty()) + { + int freq = st.top().second; + int c = st.top().first; + while(freq > 0) + { + ans += c; + freq--; + } + + st.pop(); + } + + reverse(ans.begin() , ans.end()); + return ans; + } +}; diff --git a/cpp/1299-replace-elements-with-greatest-element-on-right-side.cpp b/cpp/1299-replace-elements-with-greatest-element-on-right-side.cpp new file mode 100644 index 000000000..0116ad06a --- /dev/null +++ b/cpp/1299-replace-elements-with-greatest-element-on-right-side.cpp @@ -0,0 +1,17 @@ +class Solution { +public: + vector replaceElements(vector& arr) { + // O(N) Time Complexity , O(1) Space complexity + int n = arr.size(); + int maxSoFar = arr[n-1]; + arr[n-1] = -1; + + for(int i=n-2;i>=0;i--) + { + int temp = maxSoFar; + if(maxSoFar < arr[i]) maxSoFar = arr[i]; + arr[i] = temp; + } + return arr; + } +}; diff --git a/cpp/1448-count-good-nodes-in-binary-tree.cpp b/cpp/1448-count-good-nodes-in-binary-tree.cpp new file mode 100644 index 000000000..e59e372ad --- /dev/null +++ b/cpp/1448-count-good-nodes-in-binary-tree.cpp @@ -0,0 +1,41 @@ +/* + Given binary tree, node is "good" if path from root has no nodes > X, return # of "good" + + Maintain greatest value seen so far on a path, if further node >= this max, "good" node + + Time: O(n) + Space: O(n) +*/ + +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode() : val(0), left(nullptr), right(nullptr) {} + * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} + * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} + * }; + */ +class Solution { +public: + int goodNodes(TreeNode* root) { + int result = 0; + dfs(root, root->val, result); + return result; + } +private: + void dfs(TreeNode* root, int maxSoFar, int& result) { + if (root == NULL) { + return; + } + + if (root->val >= maxSoFar) { + result++; + } + + dfs(root->left, max(maxSoFar, root->val), result); + dfs(root->right, max(maxSoFar, root->val), result); + } +}; diff --git a/cpp/1584-min-cost-to-connect-all-points.cpp b/cpp/1584-min-cost-to-connect-all-points.cpp new file mode 100644 index 000000000..7beb444fb --- /dev/null +++ b/cpp/1584-min-cost-to-connect-all-points.cpp @@ -0,0 +1,54 @@ +/* + Given array of points, return min cost to connect all points + All points have 1 path b/w them, cost is Manhattan distance + + MST problem, Prim's, greedily pick node not in MST & has smallest edge cost + Add to MST, & for all its neighbors, try to update min dist values, repeat + + Time: O(n^2) + Space: O(n) +*/ + +class Solution { +public: + int minCostConnectPoints(vector>& points) { + int n = points.size(); + + int edgesUsed = 0; + // track visited nodes + vector inMST(n); + vector minDist(n, INT_MAX); + minDist[0] = 0; + + int result = 0; + + while (edgesUsed < n) { + int currMinEdge = INT_MAX; + int currNode = -1; + + // greedily pick lowest cost node not in MST + for (int i = 0; i < n; i++) { + if (!inMST[i] && currMinEdge > minDist[i]) { + currMinEdge = minDist[i]; + currNode = i; + } + } + + result += currMinEdge; + edgesUsed++; + inMST[currNode] = true; + + // update adj nodes of curr node + for (int i = 0; i < n; i++) { + int cost = abs(points[currNode][0] - points[i][0]) + + abs(points[currNode][1] - points[i][1]); + + if (!inMST[i] && minDist[i] > cost) { + minDist[i] = cost; + } + } + } + + return result; + } +}; diff --git a/cpp/1851-minimum-interval-to-include-each-query.cpp b/cpp/1851-minimum-interval-to-include-each-query.cpp new file mode 100644 index 000000000..1ef415eda --- /dev/null +++ b/cpp/1851-minimum-interval-to-include-each-query.cpp @@ -0,0 +1,54 @@ +/* + Given intervals array & queries array, ans to a query is min interval containing it + Ex. intervals = [[1,4],[2,4],[3,6],[4,4]], queries = [2,3,4,5] -> [3,3,1,4] + + Min heap & sort by size of intervals, top will be min size, + + Time: O(n log n + q log q) -> n = number of intervals, q = number of queries + Space: O(n + q) +*/ + +class Solution { +public: + vector minInterval(vector>& intervals, vector& queries) { + vector sortedQueries = queries; + + // [size of interval, end of interval] + priority_queue, vector>, greater>> pq; + // {query -> size of interval} + unordered_map m; + + // also need only valid intervals so sort by start time & sort queries + sort(intervals.begin(), intervals.end()); + sort(sortedQueries.begin(), sortedQueries.end()); + + vector result; + + int i = 0; + for (int j = 0; j < sortedQueries.size(); j++) { + int query = sortedQueries[j]; + + while (i < intervals.size() && intervals[i][0] <= query) { + int left = intervals[i][0]; + int right = intervals[i][1]; + pq.push({right - left + 1, right}); + i++; + } + + while (!pq.empty() && pq.top().second < query) { + pq.pop(); + } + + if (!pq.empty()) { + m[query] = pq.top().first; + } else { + m[query] = -1; + } + } + + for (int j = 0; j < queries.size(); j++) { + result.push_back(m[queries[j]]); + } + return result; + } +}; diff --git a/cpp/20-Valid-Parenthesis-String.cpp b/cpp/20-Valid-Parenthesis-String.cpp deleted file mode 100644 index f01fb9c82..000000000 --- a/cpp/20-Valid-Parenthesis-String.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - Given s containing '(', ')', or '*', determine if valid - Ex. s = "()" -> true, s = "(*)" -> true, s = "(*))" -> true - - Brute force: try both possibilities for each asterisk - Optimal: greedy, "balance", track min/max lefts - - Time: O(n) - Space: O(1) -*/ - -class Solution { -public: - bool checkValidString(string s) { - int leftMin = 0; - int leftMax = 0; - - for (int i = 0; i < s.size(); i++) { - if (s[i] == '(') { - leftMin++; - leftMax++; - } else if (s[i] == ')') { - leftMin--; - leftMax--; - } else { - leftMin--; - leftMax++; - } - if (leftMax < 0) { - return false; - } - // ex. s = "(*)(" - if (leftMin < 0) { - leftMin = 0; - } - } - - if (leftMin == 0) { - return true; - } - return false; - } -}; diff --git a/cpp/2013-detect-squares.cpp b/cpp/2013-detect-squares.cpp new file mode 100644 index 000000000..641a9d745 --- /dev/null +++ b/cpp/2013-detect-squares.cpp @@ -0,0 +1,53 @@ +/* + Given stream of points, add new points, return count of squares + + Find diagonals, if exists then forms a square, loop thru all points + + Time: O(1) add O(n^2) count -> n = number of points + Space: O(n) +*/ + +class DetectSquares { +public: + DetectSquares() { + + } + + void add(vector point) { + points[point[0]][point[1]]++; + } + + int count(vector point) { + int x1 = point[0]; + int y1 = point[1]; + + int result = 0; + + for (auto x = points.begin(); x != points.end(); x++) { + unordered_map yPoints = x->second; + for (auto y = yPoints.begin(); y != yPoints.end(); y++) { + int x3 = x->first; + int y3 = y->first; + + // skip points on same x-axis or y-axis + if (abs(x3 - x1) == 0 || abs(x3 - x1) != abs(y3 - y1)) { + continue; + } + + result += points[x3][y3] * points[x1][y3] * points[x3][y1]; + } + } + + return result; + } +private: + // {x -> {y -> count}} + unordered_map> points; +}; + +/** + * Your DetectSquares object will be instantiated and called as such: + * DetectSquares* obj = new DetectSquares(); + * obj->add(point); + * int param_2 = obj->count(point); + */ diff --git a/csharp/1-Two-Sum.cs b/csharp/0001-two-sum.cs similarity index 100% rename from csharp/1-Two-Sum.cs rename to csharp/0001-two-sum.cs diff --git a/csharp/2-Add-Two-Numbers.cs b/csharp/0002-add-two-numbers.cs similarity index 100% rename from csharp/2-Add-Two-Numbers.cs rename to csharp/0002-add-two-numbers.cs diff --git a/csharp/3-Longest-Substring-Without-Repeating-Characters.cs b/csharp/0003-longest-substring-without-repeating-characters.cs similarity index 100% rename from csharp/3-Longest-Substring-Without-Repeating-Characters.cs rename to csharp/0003-longest-substring-without-repeating-characters.cs diff --git a/csharp/4-Median-of-Two-Sorted-Arrays.cs b/csharp/0004-median-of-two-sorted-arrays.cs similarity index 100% rename from csharp/4-Median-of-Two-Sorted-Arrays.cs rename to csharp/0004-median-of-two-sorted-arrays.cs diff --git a/csharp/5-Longest-Palindromic-Substring.cs b/csharp/0005-longest-palindromic-substring.cs similarity index 100% rename from csharp/5-Longest-Palindromic-Substring.cs rename to csharp/0005-longest-palindromic-substring.cs diff --git a/csharp/7-Reverse-Integer.cs b/csharp/0007-reverse-integer.cs similarity index 100% rename from csharp/7-Reverse-Integer.cs rename to csharp/0007-reverse-integer.cs diff --git a/csharp/10-Regular-Expression-Matching.cs b/csharp/0010-regular-expression-matching.cs similarity index 100% rename from csharp/10-Regular-Expression-Matching.cs rename to csharp/0010-regular-expression-matching.cs diff --git a/csharp/11-Container-With-Most-Water.cs b/csharp/0011-container-with-most-water.cs similarity index 100% rename from csharp/11-Container-With-Most-Water.cs rename to csharp/0011-container-with-most-water.cs diff --git a/csharp/15-3Sum.cs b/csharp/0015-3sum.cs similarity index 100% rename from csharp/15-3Sum.cs rename to csharp/0015-3sum.cs diff --git a/csharp/17-Letter-Combinations-Of-A-Phone-Number.cs b/csharp/0017-letter-combinations-of-a-phone-number.cs similarity index 100% rename from csharp/17-Letter-Combinations-Of-A-Phone-Number.cs rename to csharp/0017-letter-combinations-of-a-phone-number.cs diff --git a/csharp/19-Remove-Nth-Node-From-End-of-List.cs b/csharp/0019-remove-nth-node-from-end-of-list.cs similarity index 100% rename from csharp/19-Remove-Nth-Node-From-End-of-List.cs rename to csharp/0019-remove-nth-node-from-end-of-list.cs diff --git a/csharp/20-Valid-Parentheses.cs b/csharp/0020-valid-parentheses.cs similarity index 100% rename from csharp/20-Valid-Parentheses.cs rename to csharp/0020-valid-parentheses.cs diff --git a/csharp/21-Merge-Two-Sorted-Lists.cs b/csharp/0021-merge-two-sorted-lists.cs similarity index 100% rename from csharp/21-Merge-Two-Sorted-Lists.cs rename to csharp/0021-merge-two-sorted-lists.cs diff --git a/csharp/22-Generate-Parentheses.cs b/csharp/0022-generate-parentheses.cs similarity index 100% rename from csharp/22-Generate-Parentheses.cs rename to csharp/0022-generate-parentheses.cs diff --git a/csharp/23-Merge-K-Sorted-Lists.cs b/csharp/0023-merge-k-sorted-lists.cs similarity index 100% rename from csharp/23-Merge-K-Sorted-Lists.cs rename to csharp/0023-merge-k-sorted-lists.cs diff --git a/csharp/25-Reverse-Nodes-in-k-Group.cs b/csharp/0025-reverse-nodes-in-k-group.cs similarity index 100% rename from csharp/25-Reverse-Nodes-in-k-Group.cs rename to csharp/0025-reverse-nodes-in-k-group.cs diff --git a/csharp/33-Search-In-Rotated-Sorted-Array.cs b/csharp/0033-search-in-rotated-sorted-array.cs similarity index 100% rename from csharp/33-Search-In-Rotated-Sorted-Array.cs rename to csharp/0033-search-in-rotated-sorted-array.cs diff --git a/csharp/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.cs b/csharp/0034-find-first-and-last-position-of-element-in-sorted-array.cs similarity index 100% rename from csharp/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.cs rename to csharp/0034-find-first-and-last-position-of-element-in-sorted-array.cs diff --git a/csharp/36-Valid-Sudoku.cs b/csharp/0036-valid-sudoku.cs similarity index 100% rename from csharp/36-Valid-Sudoku.cs rename to csharp/0036-valid-sudoku.cs diff --git a/csharp/39-Combination-Sum.cs b/csharp/0039-combination-sum.cs similarity index 100% rename from csharp/39-Combination-Sum.cs rename to csharp/0039-combination-sum.cs diff --git a/csharp/40-Combination-Sum-II.cs b/csharp/0040-combination-sum-ii.cs similarity index 100% rename from csharp/40-Combination-Sum-II.cs rename to csharp/0040-combination-sum-ii.cs diff --git a/csharp/42-Trapping-Rain-Water.cs b/csharp/0042-trapping-rain-water.cs similarity index 100% rename from csharp/42-Trapping-Rain-Water.cs rename to csharp/0042-trapping-rain-water.cs diff --git a/csharp/43-Multiply-Strings.cs b/csharp/0043-multiply-strings.cs similarity index 100% rename from csharp/43-Multiply-Strings.cs rename to csharp/0043-multiply-strings.cs diff --git a/csharp/45-Jump-Game-II.cs b/csharp/0045-jump-game-ii.cs similarity index 100% rename from csharp/45-Jump-Game-II.cs rename to csharp/0045-jump-game-ii.cs diff --git a/csharp/46-Permutations.cs b/csharp/0046-permutations.cs similarity index 100% rename from csharp/46-Permutations.cs rename to csharp/0046-permutations.cs diff --git a/csharp/48-Rotate-Image.cs b/csharp/0048-rotate-image.cs similarity index 100% rename from csharp/48-Rotate-Image.cs rename to csharp/0048-rotate-image.cs diff --git a/csharp/49-Group-Anagrams.cs b/csharp/0049-group-anagrams.cs similarity index 100% rename from csharp/49-Group-Anagrams.cs rename to csharp/0049-group-anagrams.cs diff --git a/csharp/50-Pow(x, n).cs b/csharp/0050-powx-n.cs similarity index 100% rename from csharp/50-Pow(x, n).cs rename to csharp/0050-powx-n.cs diff --git a/csharp/51-N-Queens.cs b/csharp/0051-n-queens.cs similarity index 100% rename from csharp/51-N-Queens.cs rename to csharp/0051-n-queens.cs diff --git a/csharp/53-Maximum-Subarray.cs b/csharp/0053-maximum-subarray.cs similarity index 100% rename from csharp/53-Maximum-Subarray.cs rename to csharp/0053-maximum-subarray.cs diff --git a/csharp/54-Spiral-Matrix.cs b/csharp/0054-spiral-matrix.cs similarity index 100% rename from csharp/54-Spiral-Matrix.cs rename to csharp/0054-spiral-matrix.cs diff --git a/csharp/55-Jump-Game.cs b/csharp/0055-jump-game.cs similarity index 100% rename from csharp/55-Jump-Game.cs rename to csharp/0055-jump-game.cs diff --git a/csharp/56-Merge-Intervals.cs b/csharp/0056-merge-intervals.cs similarity index 100% rename from csharp/56-Merge-Intervals.cs rename to csharp/0056-merge-intervals.cs diff --git a/csharp/57-Insert-Interval.cs b/csharp/0057-insert-interval.cs similarity index 100% rename from csharp/57-Insert-Interval.cs rename to csharp/0057-insert-interval.cs diff --git a/csharp/58-Length-of-Last-Word.cs b/csharp/0058-length-of-last-word.cs similarity index 100% rename from csharp/58-Length-of-Last-Word.cs rename to csharp/0058-length-of-last-word.cs diff --git a/csharp/62-Unique-Paths.cs b/csharp/0062-unique-paths.cs similarity index 100% rename from csharp/62-Unique-Paths.cs rename to csharp/0062-unique-paths.cs diff --git a/csharp/66-Plus-One.cs b/csharp/0066-plus-one.cs similarity index 100% rename from csharp/66-Plus-One.cs rename to csharp/0066-plus-one.cs diff --git a/csharp/70-Climbing Stairs.cs b/csharp/0070-climbing-stairs.cs similarity index 100% rename from csharp/70-Climbing Stairs.cs rename to csharp/0070-climbing-stairs.cs diff --git a/csharp/72-Edit-Distance.cs b/csharp/0072-edit-distance.cs similarity index 100% rename from csharp/72-Edit-Distance.cs rename to csharp/0072-edit-distance.cs diff --git a/csharp/73-Set-Matrix-Zeroes.cs b/csharp/0073-set-matrix-zeroes.cs similarity index 100% rename from csharp/73-Set-Matrix-Zeroes.cs rename to csharp/0073-set-matrix-zeroes.cs diff --git a/csharp/74-Search-A-2D-Matrix.cs b/csharp/0074-search-a-2d-matrix.cs similarity index 100% rename from csharp/74-Search-A-2D-Matrix.cs rename to csharp/0074-search-a-2d-matrix.cs diff --git a/csharp/76-Minimum-Window-Substring.cs b/csharp/0076-minimum-window-substring.cs similarity index 100% rename from csharp/76-Minimum-Window-Substring.cs rename to csharp/0076-minimum-window-substring.cs diff --git a/csharp/78-Subsets.cs b/csharp/0078-subsets.cs similarity index 100% rename from csharp/78-Subsets.cs rename to csharp/0078-subsets.cs diff --git a/csharp/79-Word-Search.cs b/csharp/0079-word-search.cs similarity index 100% rename from csharp/79-Word-Search.cs rename to csharp/0079-word-search.cs diff --git a/csharp/84-Largest-Rectangle-in-Histogram.cs b/csharp/0084-largest-rectangle-in-histogram.cs similarity index 100% rename from csharp/84-Largest-Rectangle-in-Histogram.cs rename to csharp/0084-largest-rectangle-in-histogram.cs diff --git a/csharp/90-Subsets-II.cs b/csharp/0090-subsets-ii.cs similarity index 100% rename from csharp/90-Subsets-II.cs rename to csharp/0090-subsets-ii.cs diff --git a/csharp/91-Decode-Ways.cs b/csharp/0091-decode-ways.cs similarity index 100% rename from csharp/91-Decode-Ways.cs rename to csharp/0091-decode-ways.cs diff --git a/csharp/97-Interleaving-String.cs b/csharp/0097-interleaving-string.cs similarity index 100% rename from csharp/97-Interleaving-String.cs rename to csharp/0097-interleaving-string.cs diff --git a/csharp/98-Validate-Binary-Search-Tree.cs b/csharp/0098-validate-binary-search-tree.cs similarity index 100% rename from csharp/98-Validate-Binary-Search-Tree.cs rename to csharp/0098-validate-binary-search-tree.cs diff --git a/csharp/100-Same-Tree.cs b/csharp/0100-same-tree.cs similarity index 100% rename from csharp/100-Same-Tree.cs rename to csharp/0100-same-tree.cs diff --git a/csharp/102-Binary-Tree-Level-Order-Traversal.cs b/csharp/0102-binary-tree-level-order-traversal.cs similarity index 100% rename from csharp/102-Binary-Tree-Level-Order-Traversal.cs rename to csharp/0102-binary-tree-level-order-traversal.cs diff --git a/csharp/104-Maximum-Depth-of-Binary-Tree.cs b/csharp/0104-maximum-depth-of-binary-tree.cs similarity index 100% rename from csharp/104-Maximum-Depth-of-Binary-Tree.cs rename to csharp/0104-maximum-depth-of-binary-tree.cs diff --git a/csharp/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.cs b/csharp/0105-construct-binary-tree-from-preorder-and-inorder-traversal.cs similarity index 100% rename from csharp/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.cs rename to csharp/0105-construct-binary-tree-from-preorder-and-inorder-traversal.cs diff --git a/csharp/110-Balanced-Binary-Tree.cs b/csharp/0110-balanced-binary-tree.cs similarity index 100% rename from csharp/110-Balanced-Binary-Tree.cs rename to csharp/0110-balanced-binary-tree.cs diff --git a/csharp/112-Path-Sum.cs b/csharp/0112-path-sum.cs similarity index 100% rename from csharp/112-Path-Sum.cs rename to csharp/0112-path-sum.cs diff --git a/csharp/115-Distinct-Subsequences.cs b/csharp/0115-distinct-subsequences.cs similarity index 100% rename from csharp/115-Distinct-Subsequences.cs rename to csharp/0115-distinct-subsequences.cs diff --git a/csharp/121-Best-Time-To-Buy-and-Sell-Stock.cs b/csharp/0121-best-time-to-buy-and-sell-stock.cs similarity index 100% rename from csharp/121-Best-Time-To-Buy-and-Sell-Stock.cs rename to csharp/0121-best-time-to-buy-and-sell-stock.cs diff --git a/csharp/124-Binary-Tree-Maximum-Path-Sum.cs b/csharp/0124-binary-tree-maximum-path-sum.cs similarity index 100% rename from csharp/124-Binary-Tree-Maximum-Path-Sum.cs rename to csharp/0124-binary-tree-maximum-path-sum.cs diff --git a/csharp/125-Valid-Palindrome.cs b/csharp/0125-valid-palindrome.cs similarity index 100% rename from csharp/125-Valid-Palindrome.cs rename to csharp/0125-valid-palindrome.cs diff --git a/csharp/127-Word-Ladder.cs b/csharp/0127-word-ladder.cs similarity index 100% rename from csharp/127-Word-Ladder.cs rename to csharp/0127-word-ladder.cs diff --git a/csharp/128-Longest-Consecutive-Sequence.cs b/csharp/0128-longest-consecutive-sequence.cs similarity index 100% rename from csharp/128-Longest-Consecutive-Sequence.cs rename to csharp/0128-longest-consecutive-sequence.cs diff --git a/csharp/130-Surrounded-Regions.cs b/csharp/0130-surrounded-regions.cs similarity index 100% rename from csharp/130-Surrounded-Regions.cs rename to csharp/0130-surrounded-regions.cs diff --git a/csharp/131-Palindrome-Partitioning.cs b/csharp/0131-palindrome-partitioning.cs similarity index 100% rename from csharp/131-Palindrome-Partitioning.cs rename to csharp/0131-palindrome-partitioning.cs diff --git a/csharp/133-Clone-Graph.cs b/csharp/0133-clone-graph.cs similarity index 100% rename from csharp/133-Clone-Graph.cs rename to csharp/0133-clone-graph.cs diff --git a/csharp/134-Gas-Station.cs b/csharp/0134-gas-station.cs similarity index 100% rename from csharp/134-Gas-Station.cs rename to csharp/0134-gas-station.cs diff --git a/csharp/136-Single-Number.cs b/csharp/0136-single-number.cs similarity index 100% rename from csharp/136-Single-Number.cs rename to csharp/0136-single-number.cs diff --git a/csharp/138-Copy-List-With-Random-Pointer.cs b/csharp/0138-copy-list-with-random-pointer.cs similarity index 100% rename from csharp/138-Copy-List-With-Random-Pointer.cs rename to csharp/0138-copy-list-with-random-pointer.cs diff --git a/csharp/139-Word-Break.cs b/csharp/0139-word-break.cs similarity index 100% rename from csharp/139-Word-Break.cs rename to csharp/0139-word-break.cs diff --git a/csharp/141-Linked-List-Cycle.cs b/csharp/0141-linked-list-cycle.cs similarity index 100% rename from csharp/141-Linked-List-Cycle.cs rename to csharp/0141-linked-list-cycle.cs diff --git a/csharp/143-Reorder-List.cs b/csharp/0143-reorder-list.cs similarity index 100% rename from csharp/143-Reorder-List.cs rename to csharp/0143-reorder-list.cs diff --git a/csharp/146-LRU-Cache.cs b/csharp/0146-lru-cache.cs similarity index 100% rename from csharp/146-LRU-Cache.cs rename to csharp/0146-lru-cache.cs diff --git a/csharp/150-Evaluate-Reverse-Polish-Notation.cs b/csharp/0150-evaluate-reverse-polish-notation.cs similarity index 100% rename from csharp/150-Evaluate-Reverse-Polish-Notation.cs rename to csharp/0150-evaluate-reverse-polish-notation.cs diff --git a/csharp/152-Maximum-Product-Subarray.cs b/csharp/0152-maximum-product-subarray.cs similarity index 100% rename from csharp/152-Maximum-Product-Subarray.cs rename to csharp/0152-maximum-product-subarray.cs diff --git a/csharp/153-Find-Minimum-in-Rotated-Sorted-Array.cs b/csharp/0153-find-minimum-in-rotated-sorted-array.cs similarity index 100% rename from csharp/153-Find-Minimum-in-Rotated-Sorted-Array.cs rename to csharp/0153-find-minimum-in-rotated-sorted-array.cs diff --git a/csharp/155-Min-Stack.cs b/csharp/0155-min-stack.cs similarity index 100% rename from csharp/155-Min-Stack.cs rename to csharp/0155-min-stack.cs diff --git a/csharp/167-Two-Sum-II.cs b/csharp/0167-two-sum-ii-input-array-is-sorted.cs similarity index 100% rename from csharp/167-Two-Sum-II.cs rename to csharp/0167-two-sum-ii-input-array-is-sorted.cs diff --git a/csharp/190-Reverse-Bits.cs b/csharp/0190-reverse-bits.cs similarity index 100% rename from csharp/190-Reverse-Bits.cs rename to csharp/0190-reverse-bits.cs diff --git a/csharp/191-Number-Of-1-Bits.cs b/csharp/0191-number-of-1-bits.cs similarity index 100% rename from csharp/191-Number-Of-1-Bits.cs rename to csharp/0191-number-of-1-bits.cs diff --git a/csharp/198-House-Robber.cs b/csharp/0198-house-robber.cs similarity index 100% rename from csharp/198-House-Robber.cs rename to csharp/0198-house-robber.cs diff --git a/csharp/199-Binary-Tree-Right-Side-View.cs b/csharp/0199-binary-tree-right-side-view.cs similarity index 100% rename from csharp/199-Binary-Tree-Right-Side-View.cs rename to csharp/0199-binary-tree-right-side-view.cs diff --git a/csharp/200-Number-Of-Islands.cs b/csharp/0200-number-of-islands.cs similarity index 100% rename from csharp/200-Number-Of-Islands.cs rename to csharp/0200-number-of-islands.cs diff --git a/csharp/202-Happy-Number.cs b/csharp/0202-happy-number.cs similarity index 100% rename from csharp/202-Happy-Number.cs rename to csharp/0202-happy-number.cs diff --git a/csharp/206-Reverse-Linked-List.cs b/csharp/0206-reverse-linked-list.cs similarity index 100% rename from csharp/206-Reverse-Linked-List.cs rename to csharp/0206-reverse-linked-list.cs diff --git a/csharp/207-Course-Schedule.cs b/csharp/0207-course-schedule.cs similarity index 100% rename from csharp/207-Course-Schedule.cs rename to csharp/0207-course-schedule.cs diff --git a/csharp/208-Implement-Trie.cs b/csharp/0208-implement-trie-prefix-tree.cs similarity index 100% rename from csharp/208-Implement-Trie.cs rename to csharp/0208-implement-trie-prefix-tree.cs diff --git a/csharp/210-Course-Schedule-II.cs b/csharp/0210-course-schedule-ii.cs similarity index 100% rename from csharp/210-Course-Schedule-II.cs rename to csharp/0210-course-schedule-ii.cs diff --git a/csharp/211-Design-Add-and-Search-Words-Data-Structure.cs b/csharp/0211-design-add-and-search-words-data-structure.cs similarity index 100% rename from csharp/211-Design-Add-and-Search-Words-Data-Structure.cs rename to csharp/0211-design-add-and-search-words-data-structure.cs diff --git a/csharp/212-Word-Search-II.cs b/csharp/0212-word-search-ii.cs similarity index 100% rename from csharp/212-Word-Search-II.cs rename to csharp/0212-word-search-ii.cs diff --git a/csharp/213-House-Robber-II.cs b/csharp/0213-house-robber-ii.cs similarity index 100% rename from csharp/213-House-Robber-II.cs rename to csharp/0213-house-robber-ii.cs diff --git a/csharp/215-Kth-Largest-Element-in-an-Array.cs b/csharp/0215-kth-largest-element-in-an-array.cs similarity index 100% rename from csharp/215-Kth-Largest-Element-in-an-Array.cs rename to csharp/0215-kth-largest-element-in-an-array.cs diff --git a/csharp/217-Contains-Duplicate.cs b/csharp/0217-contains-duplicate.cs similarity index 100% rename from csharp/217-Contains-Duplicate.cs rename to csharp/0217-contains-duplicate.cs diff --git a/csharp/226-Invert-Binary-Tree.cs b/csharp/0226-invert-binary-tree.cs similarity index 100% rename from csharp/226-Invert-Binary-Tree.cs rename to csharp/0226-invert-binary-tree.cs diff --git a/csharp/230-Kth-Smallest-Element-in-a-BST.cs b/csharp/0230-kth-smallest-element-in-a-bst.cs similarity index 100% rename from csharp/230-Kth-Smallest-Element-in-a-BST.cs rename to csharp/0230-kth-smallest-element-in-a-bst.cs diff --git a/csharp/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.cs b/csharp/0235-lowest-common-ancestor-of-a-binary-search-tree.cs similarity index 100% rename from csharp/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.cs rename to csharp/0235-lowest-common-ancestor-of-a-binary-search-tree.cs diff --git a/csharp/238-Product-Of-Array-Except-Self.cs b/csharp/0238-product-of-array-except-self.cs similarity index 100% rename from csharp/238-Product-Of-Array-Except-Self.cs rename to csharp/0238-product-of-array-except-self.cs diff --git a/csharp/239-Sliding-Window-Maximum.cs b/csharp/0239-sliding-window-maximum.cs similarity index 100% rename from csharp/239-Sliding-Window-Maximum.cs rename to csharp/0239-sliding-window-maximum.cs diff --git a/csharp/242-Valid-Anagram.cs b/csharp/0242-valid-anagram.cs similarity index 100% rename from csharp/242-Valid-Anagram.cs rename to csharp/0242-valid-anagram.cs diff --git a/csharp/253-Meeting-Rooms-II.cs b/csharp/0253-meeting-rooms.cs similarity index 100% rename from csharp/253-Meeting-Rooms-II.cs rename to csharp/0253-meeting-rooms.cs diff --git a/csharp/261-Graph-Valid-Tree.cs b/csharp/0261-graph-valid-tree.cs similarity index 100% rename from csharp/261-Graph-Valid-Tree.cs rename to csharp/0261-graph-valid-tree.cs diff --git a/csharp/268-Missing-Number.cs b/csharp/0268-missing-number.cs similarity index 100% rename from csharp/268-Missing-Number.cs rename to csharp/0268-missing-number.cs diff --git a/csharp/269-Alien-Dictionary.cs b/csharp/0269-alien-dictionary.cs similarity index 100% rename from csharp/269-Alien-Dictionary.cs rename to csharp/0269-alien-dictionary.cs diff --git a/csharp/271-Encode-And-Decode-Strings .cs b/csharp/0271-encode-and-decode-strings.cs similarity index 100% rename from csharp/271-Encode-And-Decode-Strings .cs rename to csharp/0271-encode-and-decode-strings.cs diff --git a/csharp/286-Walls-and-Gates.cs b/csharp/0286-walls-and-gates.cs similarity index 100% rename from csharp/286-Walls-and-Gates.cs rename to csharp/0286-walls-and-gates.cs diff --git a/csharp/287-Find-the-Duplicate-Number.cs b/csharp/0287-find-the-duplicate-number.cs similarity index 100% rename from csharp/287-Find-the-Duplicate-Number.cs rename to csharp/0287-find-the-duplicate-number.cs diff --git a/csharp/295-Find-Median-From-Data-Stream.cs b/csharp/0295-find-median-from-data-stream.cs similarity index 100% rename from csharp/295-Find-Median-From-Data-Stream.cs rename to csharp/0295-find-median-from-data-stream.cs diff --git a/csharp/297-Serialize-and-Deserialize-Binary-Tree.cs b/csharp/0297-serialize-and-deserialize-binary-tree.cs similarity index 100% rename from csharp/297-Serialize-and-Deserialize-Binary-Tree.cs rename to csharp/0297-serialize-and-deserialize-binary-tree.cs diff --git a/csharp/300-Longest-Increasing-Subsequence.cs b/csharp/0300-longest-increasing-subsequence.cs similarity index 100% rename from csharp/300-Longest-Increasing-Subsequence.cs rename to csharp/0300-longest-increasing-subsequence.cs diff --git a/csharp/309-Best-Time-to-Buy-and-Sell-Stock-With-Cooldown.cs b/csharp/0309-best-time-to-buy-and-sell-stock-with-cooldown.cs similarity index 100% rename from csharp/309-Best-Time-to-Buy-and-Sell-Stock-With-Cooldown.cs rename to csharp/0309-best-time-to-buy-and-sell-stock-with-cooldown.cs diff --git a/csharp/312-Burst-Balloons.cs b/csharp/0312-burst-balloons.cs similarity index 100% rename from csharp/312-Burst-Balloons.cs rename to csharp/0312-burst-balloons.cs diff --git a/csharp/322-Coin-Change.cs b/csharp/0322-coin-change.cs similarity index 100% rename from csharp/322-Coin-Change.cs rename to csharp/0322-coin-change.cs diff --git a/csharp/323-Number-Of-Connected-Components-In-An-Undirected-Graph.cs b/csharp/0323-number-of-connected-components-in-an-undirected-graph.cs similarity index 100% rename from csharp/323-Number-Of-Connected-Components-In-An-Undirected-Graph.cs rename to csharp/0323-number-of-connected-components-in-an-undirected-graph.cs diff --git a/csharp/329-Longest-Increasing-Path-in-a-Matrix.cs b/csharp/0329-longest-increasing-path-in-a-matrix.cs similarity index 100% rename from csharp/329-Longest-Increasing-Path-in-a-Matrix.cs rename to csharp/0329-longest-increasing-path-in-a-matrix.cs diff --git a/csharp/332-Reconstruct-Itinerary.cs b/csharp/0332-reconstruct-itinerary.cs similarity index 100% rename from csharp/332-Reconstruct-Itinerary.cs rename to csharp/0332-reconstruct-itinerary.cs diff --git a/csharp/338-Counting-Bits.cs b/csharp/0338-counting-bits.cs similarity index 100% rename from csharp/338-Counting-Bits.cs rename to csharp/0338-counting-bits.cs diff --git a/csharp/347-Top-K-Frequent-Elements.cs b/csharp/0347-top-k-frequent-elements.cs similarity index 100% rename from csharp/347-Top-K-Frequent-Elements.cs rename to csharp/0347-top-k-frequent-elements.cs diff --git a/csharp/355-Design-Twitter.cs b/csharp/0355-design-twitter.cs similarity index 100% rename from csharp/355-Design-Twitter.cs rename to csharp/0355-design-twitter.cs diff --git a/csharp/371-Sum-Of-Two-Integers.cs b/csharp/0371-sum-of-two-integers.cs similarity index 100% rename from csharp/371-Sum-Of-Two-Integers.cs rename to csharp/0371-sum-of-two-integers.cs diff --git a/csharp/392-Is-Subsequence.cs b/csharp/0392-is-subsequence.cs similarity index 100% rename from csharp/392-Is-Subsequence.cs rename to csharp/0392-is-subsequence.cs diff --git a/csharp/416-Partition-Equal-Subset-Sum.cs b/csharp/0416-partition-equal-subset-sum.cs similarity index 100% rename from csharp/416-Partition-Equal-Subset-Sum.cs rename to csharp/0416-partition-equal-subset-sum.cs diff --git a/csharp/417-Pacific-Atlantic-Water-Flow.cs b/csharp/0417-pacific-atlantic-water-flow.cs similarity index 100% rename from csharp/417-Pacific-Atlantic-Water-Flow.cs rename to csharp/0417-pacific-atlantic-water-flow.cs diff --git a/csharp/424-Longest-Repeating-Character-Replacement.cs b/csharp/0424-longest-repeating-character-replacement.cs similarity index 100% rename from csharp/424-Longest-Repeating-Character-Replacement.cs rename to csharp/0424-longest-repeating-character-replacement.cs diff --git a/csharp/435-Non-overlapping-Intervals.cs b/csharp/0435-non-overlapping-intervals.cs similarity index 100% rename from csharp/435-Non-overlapping-Intervals.cs rename to csharp/0435-non-overlapping-intervals.cs diff --git a/csharp/438-Find-All-Anagrams-In-A-String.cs b/csharp/0438-find-all-anagrams-in-a-string.cs similarity index 100% rename from csharp/438-Find-All-Anagrams-In-A-String.cs rename to csharp/0438-find-all-anagrams-in-a-string.cs diff --git a/csharp/463-Island-Perimeter.cs b/csharp/0463-island-perimeter.cs similarity index 100% rename from csharp/463-Island-Perimeter.cs rename to csharp/0463-island-perimeter.cs diff --git a/csharp/494-Target-Sum.cs b/csharp/0494-target-sum.cs similarity index 100% rename from csharp/494-Target-Sum.cs rename to csharp/0494-target-sum.cs diff --git a/csharp/518-Coin-Change-II.cs b/csharp/0518-coin-change-ii.cs similarity index 100% rename from csharp/518-Coin-Change-II.cs rename to csharp/0518-coin-change-ii.cs diff --git a/csharp/543-Diameter-of-Binary-Tree.cs b/csharp/0543-diameter-of-binary-tree.cs similarity index 100% rename from csharp/543-Diameter-of-Binary-Tree.cs rename to csharp/0543-diameter-of-binary-tree.cs diff --git a/csharp/567-Permutation-In-String.cs b/csharp/0567-permutation-in-string.cs similarity index 100% rename from csharp/567-Permutation-In-String.cs rename to csharp/0567-permutation-in-string.cs diff --git a/csharp/572-Subtree-of-Another-Tree.cs b/csharp/0572-subtree-of-another-tree.cs similarity index 100% rename from csharp/572-Subtree-of-Another-Tree.cs rename to csharp/0572-subtree-of-another-tree.cs diff --git a/csharp/621-Task-Scheduler.cs b/csharp/0621-task-scheduler.cs similarity index 100% rename from csharp/621-Task-Scheduler.cs rename to csharp/0621-task-scheduler.cs diff --git a/csharp/647-Palindromic-Substrings.cs b/csharp/0647-palindromic-substrings.cs similarity index 100% rename from csharp/647-Palindromic-Substrings.cs rename to csharp/0647-palindromic-substrings.cs diff --git a/csharp/678-Valid-Parenthesis-String.cs b/csharp/0678-valid-parenthesis-string.cs similarity index 100% rename from csharp/678-Valid-Parenthesis-String.cs rename to csharp/0678-valid-parenthesis-string.cs diff --git a/csharp/684-Redundant-Connection.cs b/csharp/0684-redundant-connection.cs similarity index 100% rename from csharp/684-Redundant-Connection.cs rename to csharp/0684-redundant-connection.cs diff --git a/csharp/695-Max-Area-of-Island.cs b/csharp/0695-max-area-of-island.cs similarity index 100% rename from csharp/695-Max-Area-of-Island.cs rename to csharp/0695-max-area-of-island.cs diff --git a/csharp/703-Kth-Largest-Element-In-A-Stream.cs b/csharp/0703-kth-largest-element-in-a-stream.cs similarity index 100% rename from csharp/703-Kth-Largest-Element-In-A-Stream.cs rename to csharp/0703-kth-largest-element-in-a-stream.cs diff --git a/csharp/704-Binary-Search.cs b/csharp/0704-binary-search.cs similarity index 100% rename from csharp/704-Binary-Search.cs rename to csharp/0704-binary-search.cs diff --git a/csharp/739-Daily-Temperatures.cs b/csharp/0739-daily-temperatures.cs similarity index 100% rename from csharp/739-Daily-Temperatures.cs rename to csharp/0739-daily-temperatures.cs diff --git a/csharp/743-Network-Delay-Time.cs b/csharp/0743-network-delay-time.cs similarity index 100% rename from csharp/743-Network-Delay-Time.cs rename to csharp/0743-network-delay-time.cs diff --git a/csharp/746-Min-Cost-Climbing-Stairs.cs b/csharp/0746-min-cost-climbing-stairs.cs similarity index 100% rename from csharp/746-Min-Cost-Climbing-Stairs.cs rename to csharp/0746-min-cost-climbing-stairs.cs diff --git a/csharp/752-Open-the-Lock.cs b/csharp/0752-open-the-lock.cs similarity index 100% rename from csharp/752-Open-the-Lock.cs rename to csharp/0752-open-the-lock.cs diff --git a/csharp/763-Partition-Labels.cs b/csharp/0763-partition-labels.cs similarity index 100% rename from csharp/763-Partition-Labels.cs rename to csharp/0763-partition-labels.cs diff --git a/csharp/778-Swim-in-Rising-Water.cs b/csharp/0778-swim-in-rising-water.cs similarity index 100% rename from csharp/778-Swim-in-Rising-Water.cs rename to csharp/0778-swim-in-rising-water.cs diff --git a/csharp/787-Cheapest-Flights-Within-K-Stops.cs b/csharp/0787-cheapest-flights-within-k-stops.cs similarity index 100% rename from csharp/787-Cheapest-Flights-Within-K-Stops.cs rename to csharp/0787-cheapest-flights-within-k-stops.cs diff --git a/csharp/846-Hand-of-Straights.cs b/csharp/0846-hand-of-straights.cs similarity index 100% rename from csharp/846-Hand-of-Straights.cs rename to csharp/0846-hand-of-straights.cs diff --git a/csharp/853-Car-Fleet.cs b/csharp/0853-car-fleet.cs similarity index 100% rename from csharp/853-Car-Fleet.cs rename to csharp/0853-car-fleet.cs diff --git a/csharp/875-Koko-Eating-Bananas.cs b/csharp/0875-koko-eating-bananas.cs similarity index 100% rename from csharp/875-Koko-Eating-Bananas.cs rename to csharp/0875-koko-eating-bananas.cs diff --git a/csharp/909-Snakes-and-Ladders.cs b/csharp/0909-snakes-and-ladders.cs similarity index 100% rename from csharp/909-Snakes-and-Ladders.cs rename to csharp/0909-snakes-and-ladders.cs diff --git a/csharp/973-K-Closest-Points-To-Origin.cs b/csharp/0973-k-closest-points-to-origin.cs similarity index 100% rename from csharp/973-K-Closest-Points-To-Origin.cs rename to csharp/0973-k-closest-points-to-origin.cs diff --git a/csharp/981-Time-Based-Key-Value-Store.cs b/csharp/0981-time-based-key-value-store.cs similarity index 100% rename from csharp/981-Time-Based-Key-Value-Store.cs rename to csharp/0981-time-based-key-value-store.cs diff --git a/csharp/994-Rotting-Oranges.cs b/csharp/0994-rotting-oranges.cs similarity index 100% rename from csharp/994-Rotting-Oranges.cs rename to csharp/0994-rotting-oranges.cs diff --git a/csharp/1046-last-stone-weight.cs b/csharp/1046-last-stone-weight.cs new file mode 100644 index 000000000..9922e3179 --- /dev/null +++ b/csharp/1046-last-stone-weight.cs @@ -0,0 +1,49 @@ +public class Solution +{ + private PriorityQueue pq; + + // T: O(NLogN) + public int LastStoneWeight(int[] stones) + { + pq = new PriorityQueue(new MaxHeapComparer()); + + AddStones(stones); + ComputeLastStoneWeight(); + + return pq.Count == 0 ? 0 : pq.Dequeue(); + } + + + private void AddStones(int[] stones) + { + foreach (var stone in stones) + { + // T: Heapify is O(N) for every enqueued item + pq.Enqueue(stone, stone); + } + } + + // T: O(NLogN), to get max value its O(LogN) and we perform this for N items => O(NLogN) + private void ComputeLastStoneWeight() + { + while (pq.Count > 1) + { + var y = pq.Dequeue(); + var x = pq.Dequeue(); + + if (x != y) + { + var diff = y - x; + pq.Enqueue(diff, diff); + } + } + } + + public class MaxHeapComparer : IComparer + { + public int Compare(int x, int y) + { + return y - x; + } + } +} \ No newline at end of file diff --git a/csharp/1094-car-pooling.cs b/csharp/1094-car-pooling.cs new file mode 100644 index 000000000..761921659 --- /dev/null +++ b/csharp/1094-car-pooling.cs @@ -0,0 +1,19 @@ +public class Solution { + public bool CarPooling(int[][] trips, int capacity) { + var dictionary = new SortedDictionary(); + + foreach (var trip in trips) + { + if (!dictionary.ContainsKey(trip[1])) dictionary[trip[1]] = 0; + if (!dictionary.ContainsKey(trip[2])) dictionary[trip[2]] = 0; + dictionary[trip[1]] += trip[0]; dictionary[trip[2]] -= trip[0]; + } + int currentPassennger = 0; + foreach (var keyval in dictionary) + { + currentPassennger += keyval.Value; + if (currentPassennger > capacity) return false; + } + return true; + } +} diff --git a/csharp/1143-longest-common-subsequence.cs b/csharp/1143-longest-common-subsequence.cs new file mode 100644 index 000000000..cc2057fcb --- /dev/null +++ b/csharp/1143-longest-common-subsequence.cs @@ -0,0 +1,23 @@ +public class Solution { + public int LongestCommonSubsequence(string text1, string text2) { + int[,] dp = new int[text1.Length + 1, text2.Length + 1]; + for (int i = 0; i < text1.Length + 1; i++) + { + for (int j = 0; j < text2.Length + 1; j++) + { + dp[i, j] = 0; + } + } + for (int i = text1.Length - 1; i >= 0; i--) + { + for (int j = text2.Length - 1; j >= 0; j--) + { + if (text1[i] == text2[j]) + dp[i, j] = 1 + dp[i + 1, j + 1]; + else + dp[i, j] = Math.Max(dp[i, j + 1], dp[i + 1, j]); + } + } + return dp[0, 0]; + } +} diff --git a/csharp/1299-replace-elements-with-greatest-element-on-right-side.cs b/csharp/1299-replace-elements-with-greatest-element-on-right-side.cs new file mode 100644 index 000000000..6908948d6 --- /dev/null +++ b/csharp/1299-replace-elements-with-greatest-element-on-right-side.cs @@ -0,0 +1,11 @@ +public class Solution { + public int[] ReplaceElements(int[] arr) { + int max = -1; + for(int i = arr.Length-1; i >= 0; i--) { + int newMax = Math.Max(arr[i], max); + arr[i] = max; + max = newMax; + } + return arr; + } +} \ No newline at end of file diff --git a/csharp/1383-maximum-performance-of-a-team.cs b/csharp/1383-maximum-performance-of-a-team.cs new file mode 100644 index 000000000..9295535d5 --- /dev/null +++ b/csharp/1383-maximum-performance-of-a-team.cs @@ -0,0 +1,36 @@ +public class Solution { +public class Engineer + { + public int speed; + public int efficiency; + public Engineer(int speed, int efficiency) + { + this.speed = speed; + this.efficiency = efficiency; + } + + } + + public int MaxPerformance(int n, int[] speed, int[] efficiency, int k) + { + List engineers = new(); + for (int i = 0; i < n; i++) + { + engineers.Add(new Engineer(speed[i], efficiency[i])); + } + + engineers = engineers.OrderByDescending(x => x.efficiency).ToList(); + var queue = new PriorityQueue(); + long speedTotal = 0, result = 0; + foreach (var engineer in engineers) + { + if (queue.Count > k - 1) + speedTotal -= queue.Dequeue(); + queue.Enqueue(engineer.speed, engineer.speed); + speedTotal += engineer.speed; + result = Math.Max(result, speedTotal * engineer.efficiency); + } + + return (int)(result % 1000000007); + } +} diff --git a/csharp/1423-maximum-points-you-can-obtain-from-cards.cs b/csharp/1423-maximum-points-you-can-obtain-from-cards.cs new file mode 100644 index 000000000..41ee26354 --- /dev/null +++ b/csharp/1423-maximum-points-you-can-obtain-from-cards.cs @@ -0,0 +1,21 @@ +public class Solution { + public int MaxScore(int[] cardPoints, int k) { + if (k > cardPoints.Length) + { + return cardPoints.Sum(); + } + int res = 0, total = 0; + int l = 0, r = cardPoints.Length - k; + for (int i = r; i < cardPoints.Length; i++) + total += cardPoints[i]; + res = total; + while (r < cardPoints.Length) + { + total += cardPoints[l] - cardPoints[r]; + res = Math.Max(res, total); + l++; + r++; + } + return res; + } +} diff --git a/csharp/1448-count-good-nodes-in-binary-tree.cs b/csharp/1448-count-good-nodes-in-binary-tree.cs new file mode 100644 index 000000000..68cf2e8f0 --- /dev/null +++ b/csharp/1448-count-good-nodes-in-binary-tree.cs @@ -0,0 +1,30 @@ +/** + * Definition for a binary tree node. + * public class TreeNode { + * public int val; + * public TreeNode left; + * public TreeNode right; + * public TreeNode(int val=0, TreeNode left=null, TreeNode right=null) { + * this.val = val; + * this.left = left; + * this.right = right; + * } + * } + */ +public class Solution { + private int goodNodeCount = 0; + public void dfs(TreeNode cur, int pathMax) { + if(cur == null) return; + if(cur.val >= pathMax) { + pathMax = cur.val; + goodNodeCount++; + } + dfs(cur.left, pathMax); + dfs(cur.right, pathMax); + + } + public int GoodNodes(TreeNode root) { + dfs(root, int.MinValue); + return goodNodeCount; + } +} \ No newline at end of file diff --git a/csharp/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.cs b/csharp/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.cs new file mode 100644 index 000000000..83ffe75da --- /dev/null +++ b/csharp/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.cs @@ -0,0 +1,47 @@ +public class Solution { + public int MinReorder(int n, int[][] connections) + { + if (connections == null || connections?.Length < 2) return 0; + + Dictionary> paths = new Dictionary>(); + List[] graph = new List[n]; + foreach (var connection in connections) + { + if (!paths.ContainsKey(connection[0])) + paths.Add(connection[0], new HashSet()); + + paths[connection[0]].Add(connection[1]); + + if (graph[connection[0]] == null) + graph[connection[0]] = new List(); + graph[connection[0]].Add(connection[1]); + + if (graph[connection[1]] == null) + graph[connection[1]] = new List(); + graph[connection[1]].Add(connection[0]); + } + int cnt = 0; + HashSet visited = new HashSet(); + DFSMinReorder(graph, 0, paths, visited, ref cnt); + return cnt; + } + + private void DFSMinReorder(List[] graph, int u, Dictionary> paths, HashSet visited, ref int cnt) + { + visited.Add(u); + + if (graph[u] != null) + { + foreach (var v in graph[u]) + { + if (!visited.Contains(v)) + { + if (paths.ContainsKey(u) && paths[u].Contains(v)) + cnt++; + + DFSMinReorder(graph, v, paths, visited, ref cnt); + } + } + } + } +} diff --git a/csharp/1584-min-cost-to-connect-all-points.cs b/csharp/1584-min-cost-to-connect-all-points.cs new file mode 100644 index 000000000..e3480dc8b --- /dev/null +++ b/csharp/1584-min-cost-to-connect-all-points.cs @@ -0,0 +1,60 @@ +public class Solution +{ + //T: O(N^2 LogN) + public int MinCostConnectPoints(int[][] points) + { + //creating the ajacency list. + var N = points.Length; + var dictionary = new Dictionary>>(); //Cost and Node + + if (N == 1) + return 0; + + for (var i = 0; i < N; i++) + { + dictionary.Add(i, new List>()); + } + + for (var i = 0; i < N; i++) + { + var x1 = points[i][0]; + var y1 = points[i][1]; + + for (var j = i + 1; j < N; j++) + { + var x2 = points[j][0]; + var y2 = points[j][1]; + + var dist = Math.Abs(x2 - x1) + Math.Abs(y1 - y2); + + dictionary[j].Add(new Tuple(dist, i)); + dictionary[i].Add(new Tuple(dist, j)); + + } + } + + var res = 0; + //Prim's + var visited = new HashSet(); + var minHeap = new PriorityQueue<(int, int), int>(); // Cost and Node + minHeap.Enqueue((0, 0), 0); + + while (minHeap.Count > 0) + { + var (cost, point) = minHeap.Dequeue(); + if (visited.Contains(point)) + continue; + res += cost; + visited.Add(point); + var adj = dictionary[point]; + + for (var i = 0; i < adj.Count; i++) + { + if (!visited.Contains(adj[i].Item2)) + minHeap.Enqueue((adj[i].Item1, adj[i].Item2), adj[i].Item1); + } + } + + return res; + } +} \ No newline at end of file diff --git a/csharp/1838-frequency-of-the-most-frequent-element.cs b/csharp/1838-frequency-of-the-most-frequent-element.cs new file mode 100644 index 000000000..1693b19a5 --- /dev/null +++ b/csharp/1838-frequency-of-the-most-frequent-element.cs @@ -0,0 +1,22 @@ +public class Solution { + public int MaxFrequency(int[] nums, int k) { + Array.Sort(nums); + + int left = 0, right = 0; + var max = 0; + long totalSum = 0; + + for(right = 0; right < nums.Length; right++) { + totalSum += nums[right]; + + while(nums[right] * (right - left + 1) > totalSum + k) { + totalSum -= nums[left]; + left++; + } + + max = Math.Max((right - left + 1), max); + } + + return max; + } +} \ No newline at end of file diff --git a/csharp/1851-minimum-interval-to-include-each-query.cs b/csharp/1851-minimum-interval-to-include-each-query.cs new file mode 100644 index 000000000..429c40574 --- /dev/null +++ b/csharp/1851-minimum-interval-to-include-each-query.cs @@ -0,0 +1,44 @@ +public class Solution +{ + public int[] MinInterval(int[][] intervals, int[] queries) + { + + var q = queries.Length; + var indexDict = new int[q][]; + var index = 0; + foreach (var query in queries) + { + indexDict[index] = new int[2] { query, index }; + index++; + } + Array.Sort(indexDict, (a, b) => a[0] - b[0]); + Array.Sort(intervals, (a, b) => a[0] - b[0]); + + var pq = new PriorityQueue(); + var result = new int[queries.Length]; + + index = 0; + foreach (var query in indexDict) + { + var resultIndex = query; + var calResult = -1; + + while (index < intervals.Length && intervals[index][0] <= resultIndex[0]) + { + var curr = intervals[index]; + pq.Enqueue(new int[2] { curr[1] - curr[0] + 1, curr[1] }, curr[1] - curr[0] + 1); + index++; + } + + while (pq.Count > 0 && pq.Peek()[1] < resultIndex[0]) + { + pq.Dequeue(); + } + calResult = pq.Count > 0 ? pq.Peek()[0] : -1; + result[resultIndex[1]] = calResult; + } + + return result; + + } +} \ No newline at end of file diff --git a/csharp/1905-count-sub-islands.cs b/csharp/1905-count-sub-islands.cs new file mode 100644 index 000000000..3e195199c --- /dev/null +++ b/csharp/1905-count-sub-islands.cs @@ -0,0 +1,30 @@ +public class Solution { + public int CountSubIslands(int[][] grid1, int[][] grid2) + { + int r = grid1.Length, c = grid1[0].Length, subIslands = 0; + for (int i = 0; i < r; i++) + { + for (int j = 0; j < c; j++) + { + if (grid2[i][j] == 1 && DfsSubIsLand(grid1, grid2, i, j)) + { + subIslands++; + } + } + } + return subIslands; + } + + private bool DfsSubIsLand(int[][] grid1, int[][] grid2, int r, int c) + { + if (r < 0 || c < 0 || r >= grid2.Length || c >= grid2[r].Length || grid2[r][c] == 0) { return true; } + + grid2[r][c] = 0; + bool stillASubIsland = true; + stillASubIsland &= DfsSubIsLand(grid1, grid2, r-1, c); + stillASubIsland &= DfsSubIsLand(grid1, grid2, r, c+1); + stillASubIsland &= DfsSubIsLand(grid1, grid2, r+1, c); + stillASubIsland &= DfsSubIsLand(grid1, grid2, r, c-1); + return stillASubIsland && grid1[r][c] == 1; + } +} diff --git a/csharp/2013-detect-squares.cs b/csharp/2013-detect-squares.cs new file mode 100644 index 000000000..a66b48ff5 --- /dev/null +++ b/csharp/2013-detect-squares.cs @@ -0,0 +1,35 @@ +public class DetectSquares { + + private Dictionary<(int x, int y), int> _pointsCounter = new(); + private List<(int x, int y)> _points = new(); + + public DetectSquares() { } + + public void Add(int[] point) { + var p = (point[0], point[1]); + _points.Add(p); + _pointsCounter[p] = 1 + _pointsCounter.GetValueOrDefault(p, 0); + } + + public int Count(int[] point) { + int px = point[0], py = point[1]; + int result = 0; + + foreach (var (x, y) in _points) { + + if (Math.Abs(px - x) != Math.Abs(py - y) + || x == px || y == py) { + continue; + } + result += _pointsCounter.GetValueOrDefault((px, y), 0) * _pointsCounter.GetValueOrDefault((x, py), 0); + } + return result; + } +} + +/** + * Your DetectSquares object will be instantiated and called as such: + * DetectSquares obj = new DetectSquares(); + * obj.Add(point); + * int param_2 = obj.Count(point); + */ \ No newline at end of file diff --git a/go/1-Two-Sum.go b/go/0001-two-sum.go similarity index 100% rename from go/1-Two-Sum.go rename to go/0001-two-sum.go diff --git a/go/3-Longest-Substring-Without-Repeating-Characters.go b/go/0003-longest-substring-without-repeating-characters.go similarity index 100% rename from go/3-Longest-Substring-Without-Repeating-Characters.go rename to go/0003-longest-substring-without-repeating-characters.go diff --git a/go/4-Median-Of-Two-Sorted-Arrays.go b/go/0004-median-of-two-sorted-arrays.go similarity index 100% rename from go/4-Median-Of-Two-Sorted-Arrays.go rename to go/0004-median-of-two-sorted-arrays.go diff --git a/go/7-Reverse-Integer.go b/go/0007-reverse-integer.go similarity index 100% rename from go/7-Reverse-Integer.go rename to go/0007-reverse-integer.go diff --git a/go/11-Container-with-Most-Water.go b/go/0011-container-with-most-water.go similarity index 100% rename from go/11-Container-with-Most-Water.go rename to go/0011-container-with-most-water.go diff --git a/go/13-Roman-To-Integer.go b/go/0013-roman-to-integer.go similarity index 100% rename from go/13-Roman-To-Integer.go rename to go/0013-roman-to-integer.go diff --git a/go/15-3Sum.go b/go/0015-3sum.go similarity index 100% rename from go/15-3Sum.go rename to go/0015-3sum.go diff --git a/go/17-Letter-Combinations-of-a-Phone-Number.go b/go/0017-letter-combinations-of-a-phone-number.go similarity index 100% rename from go/17-Letter-Combinations-of-a-Phone-Number.go rename to go/0017-letter-combinations-of-a-phone-number.go diff --git a/go/19-Remove-Nth-Node-From-End-of-List.go b/go/0019-remove-nth-node-from-end-of-list.go similarity index 100% rename from go/19-Remove-Nth-Node-From-End-of-List.go rename to go/0019-remove-nth-node-from-end-of-list.go diff --git a/go/20-Valid-Parentheses.go b/go/0020-valid-parentheses.go similarity index 100% rename from go/20-Valid-Parentheses.go rename to go/0020-valid-parentheses.go diff --git a/go/21-Merge-Two-Sorted-Lists.go b/go/0021-merge-two-sorted-lists.go similarity index 100% rename from go/21-Merge-Two-Sorted-Lists.go rename to go/0021-merge-two-sorted-lists.go diff --git a/go/22-Generate_Parentheses.go b/go/0022-generate-parentheses.go similarity index 100% rename from go/22-Generate_Parentheses.go rename to go/0022-generate-parentheses.go diff --git a/go/24-Swap-Nodes-in-Pairs.go b/go/0024-swap-nodes-in-pairs.go similarity index 100% rename from go/24-Swap-Nodes-in-Pairs.go rename to go/0024-swap-nodes-in-pairs.go diff --git a/go/26-Remove-Duplicates-From-Sorted-Array.go b/go/0026-remove-duplicates-from-sorted-array.go similarity index 100% rename from go/26-Remove-Duplicates-From-Sorted-Array.go rename to go/0026-remove-duplicates-from-sorted-array.go diff --git a/go/27-Remove-Element.go b/go/0027-remove-element.go similarity index 100% rename from go/27-Remove-Element.go rename to go/0027-remove-element.go diff --git a/go/33-Search-in-Rotated-Sorted-Array.go b/go/0033-search-in-rotated-sorted-array.go similarity index 100% rename from go/33-Search-in-Rotated-Sorted-Array.go rename to go/0033-search-in-rotated-sorted-array.go diff --git a/go/36-Valid-Sudoku.go b/go/0036-valid-sudoku.go similarity index 100% rename from go/36-Valid-Sudoku.go rename to go/0036-valid-sudoku.go diff --git a/go/39-Combination-Sum.go b/go/0039-combination-sum.go similarity index 100% rename from go/39-Combination-Sum.go rename to go/0039-combination-sum.go diff --git a/go/40-Combination-Sum-II.go b/go/0040-combination-sum-ii.go similarity index 100% rename from go/40-Combination-Sum-II.go rename to go/0040-combination-sum-ii.go diff --git a/go/42-Trapping-Rain-Water.go b/go/0042-trapping-rain-water.go similarity index 100% rename from go/42-Trapping-Rain-Water.go rename to go/0042-trapping-rain-water.go diff --git a/go/45-Jump-Game-II.go b/go/0045-jump-game-ii.go similarity index 100% rename from go/45-Jump-Game-II.go rename to go/0045-jump-game-ii.go diff --git a/go/46-Permutations.go b/go/0046-permutations.go similarity index 100% rename from go/46-Permutations.go rename to go/0046-permutations.go diff --git a/go/48-Rotate-Image.go b/go/0048-rotate-image.go similarity index 100% rename from go/48-Rotate-Image.go rename to go/0048-rotate-image.go diff --git a/go/49-Group-Anagrams.go b/go/0049-group-anagrams.go similarity index 100% rename from go/49-Group-Anagrams.go rename to go/0049-group-anagrams.go diff --git a/go/51-N-Queens.go b/go/0051-n-queens.go similarity index 100% rename from go/51-N-Queens.go rename to go/0051-n-queens.go diff --git a/go/53-Maximum-Subarray.go b/go/0053-maximum-subarray.go similarity index 100% rename from go/53-Maximum-Subarray.go rename to go/0053-maximum-subarray.go diff --git a/go/55-Jump-Game.go b/go/0055-jump-game.go similarity index 100% rename from go/55-Jump-Game.go rename to go/0055-jump-game.go diff --git a/go/56-Merge-Intervals.go b/go/0056-merge-intervals.go similarity index 100% rename from go/56-Merge-Intervals.go rename to go/0056-merge-intervals.go diff --git a/go/62-Unique-Paths.go b/go/0062-unique-paths.go similarity index 100% rename from go/62-Unique-Paths.go rename to go/0062-unique-paths.go diff --git a/go/66-Plus-One.go b/go/0066-plus-one.go similarity index 100% rename from go/66-Plus-One.go rename to go/0066-plus-one.go diff --git a/go/70-Climbing-Stairs.go b/go/0070-climbing-stairs.go similarity index 100% rename from go/70-Climbing-Stairs.go rename to go/0070-climbing-stairs.go diff --git a/go/73-Set-Matrix-Zeroes.go b/go/0073-set-matrix-zeroes.go similarity index 100% rename from go/73-Set-Matrix-Zeroes.go rename to go/0073-set-matrix-zeroes.go diff --git a/go/74-Search-A-2D-Matrix.go b/go/0074-search-a-2d-matrix.go similarity index 100% rename from go/74-Search-A-2D-Matrix.go rename to go/0074-search-a-2d-matrix.go diff --git a/go/75-Sort-Colors.go b/go/0075-sort-colors.go similarity index 100% rename from go/75-Sort-Colors.go rename to go/0075-sort-colors.go diff --git a/go/76-Minimum-Window-Substring.go b/go/0076-minimum-window-substring.go similarity index 100% rename from go/76-Minimum-Window-Substring.go rename to go/0076-minimum-window-substring.go diff --git a/go/78-Subsets.go b/go/0078-subsets.go similarity index 100% rename from go/78-Subsets.go rename to go/0078-subsets.go diff --git a/go/79-Word-Search.go b/go/0079-word-search.go similarity index 100% rename from go/79-Word-Search.go rename to go/0079-word-search.go diff --git a/go/83-Remove-Duplicates-from-Sorted-List.go b/go/0083-remove-duplicates-from-sorted-list.go similarity index 100% rename from go/83-Remove-Duplicates-from-Sorted-List.go rename to go/0083-remove-duplicates-from-sorted-list.go diff --git a/go/84-Largest-Rectangle-In-Histogram.go b/go/0084-largest-rectangle-in-histogram.go similarity index 100% rename from go/84-Largest-Rectangle-In-Histogram.go rename to go/0084-largest-rectangle-in-histogram.go diff --git a/go/90-Subsets-II.go b/go/0090-subsets-ii.go similarity index 100% rename from go/90-Subsets-II.go rename to go/0090-subsets-ii.go diff --git a/go/98-Validate-Binary-Search-Tree.go b/go/0098-validate-binary-search-tree.go similarity index 100% rename from go/98-Validate-Binary-Search-Tree.go rename to go/0098-validate-binary-search-tree.go diff --git a/go/100-Same-Tree.go b/go/0100-same-tree.go similarity index 100% rename from go/100-Same-Tree.go rename to go/0100-same-tree.go diff --git a/go/102-Binary-Tree-Level-Order-Traversal.go b/go/0102-binary-tree-level-order-traversal.go similarity index 100% rename from go/102-Binary-Tree-Level-Order-Traversal.go rename to go/0102-binary-tree-level-order-traversal.go diff --git a/go/104-Maximum-Depth-of-Binary-Tree.go b/go/0104-maximum-depth-of-binary-tree.go similarity index 100% rename from go/104-Maximum-Depth-of-Binary-Tree.go rename to go/0104-maximum-depth-of-binary-tree.go diff --git a/go/110-Balanced-Binary-Tree.go b/go/0110-balanced-binary-tree.go similarity index 100% rename from go/110-Balanced-Binary-Tree.go rename to go/0110-balanced-binary-tree.go diff --git a/go/121-Best-Time-To-Buy-And-Sell-Stock.go b/go/0121-best-time-to-buy-and-sell-stock.go similarity index 100% rename from go/121-Best-Time-To-Buy-And-Sell-Stock.go rename to go/0121-best-time-to-buy-and-sell-stock.go diff --git a/go/122-Best-Time-to-Buy-and-Sell-Stock-II.go b/go/0122-best-time-to-buy-and-sell-stock-ii.go similarity index 100% rename from go/122-Best-Time-to-Buy-and-Sell-Stock-II.go rename to go/0122-best-time-to-buy-and-sell-stock-ii.go diff --git a/go/124-Binary-Tree-Maximum-Path-Sum.go b/go/0124-binary-tree-maximum-path-sum.go similarity index 100% rename from go/124-Binary-Tree-Maximum-Path-Sum.go rename to go/0124-binary-tree-maximum-path-sum.go diff --git a/go/125-Valid-Palindrome.go b/go/0125-valid-palindrome.go similarity index 100% rename from go/125-Valid-Palindrome.go rename to go/0125-valid-palindrome.go diff --git a/go/128-Longest-Consecutive-Sequence.go b/go/0128-longest-consecutive-sequence.go similarity index 100% rename from go/128-Longest-Consecutive-Sequence.go rename to go/0128-longest-consecutive-sequence.go diff --git a/go/130-Surrounded-Regions.go b/go/0130-surrounded-regions.go similarity index 100% rename from go/130-Surrounded-Regions.go rename to go/0130-surrounded-regions.go diff --git a/go/131-Palindrome-Partitioning.go b/go/0131-palindrome-partitioning.go similarity index 100% rename from go/131-Palindrome-Partitioning.go rename to go/0131-palindrome-partitioning.go diff --git a/go/133-Clone-Graph.go b/go/0133-clone-graph.go similarity index 100% rename from go/133-Clone-Graph.go rename to go/0133-clone-graph.go diff --git a/go/134-Gas-Station.go b/go/0134-gas-station.go similarity index 100% rename from go/134-Gas-Station.go rename to go/0134-gas-station.go diff --git a/go/136-Single-Number.go b/go/0136-single-number.go similarity index 100% rename from go/136-Single-Number.go rename to go/0136-single-number.go diff --git a/go/141-Linked-List-Cycle.go b/go/0141-linked-list-cycle.go similarity index 100% rename from go/141-Linked-List-Cycle.go rename to go/0141-linked-list-cycle.go diff --git a/go/143-Reorder-List.go b/go/0143-reorder-list.go similarity index 100% rename from go/143-Reorder-List.go rename to go/0143-reorder-list.go diff --git a/go/150-Evaluate-Reverse-Polish-Notation.go b/go/0150-evaluate-reverse-polish-notation.go similarity index 100% rename from go/150-Evaluate-Reverse-Polish-Notation.go rename to go/0150-evaluate-reverse-polish-notation.go diff --git a/go/152-Maximum-Product-Subarray.go b/go/0152-maximum-product-subarray.go similarity index 100% rename from go/152-Maximum-Product-Subarray.go rename to go/0152-maximum-product-subarray.go diff --git a/go/153-Find-Minimum-in-Rotated-Sorted-Array.go b/go/0153-find-minimum-in-rotated-sorted-array.go similarity index 100% rename from go/153-Find-Minimum-in-Rotated-Sorted-Array.go rename to go/0153-find-minimum-in-rotated-sorted-array.go diff --git a/go/155-Min-Stack.go b/go/0155-min-stack.go similarity index 100% rename from go/155-Min-Stack.go rename to go/0155-min-stack.go diff --git a/go/167-Two-Sum-II.go b/go/0167-two-sum-ii-input-array-is-sorted.go similarity index 100% rename from go/167-Two-Sum-II.go rename to go/0167-two-sum-ii-input-array-is-sorted.go diff --git a/go/190-Reverse-Bits.go b/go/0190-reverse-bits.go similarity index 100% rename from go/190-Reverse-Bits.go rename to go/0190-reverse-bits.go diff --git a/go/191-Number-of-1-Bits.go b/go/0191-number-of-1-bits.go similarity index 100% rename from go/191-Number-of-1-Bits.go rename to go/0191-number-of-1-bits.go diff --git a/go/198-House-Robber.go b/go/0198-house-robber.go similarity index 100% rename from go/198-House-Robber.go rename to go/0198-house-robber.go diff --git a/go/202-Happy-Number.go b/go/0202-happy-number.go similarity index 100% rename from go/202-Happy-Number.go rename to go/0202-happy-number.go diff --git a/go/203-Remove-Linked-List-Element.go b/go/0203-remove-linked-list-elements.go similarity index 100% rename from go/203-Remove-Linked-List-Element.go rename to go/0203-remove-linked-list-elements.go diff --git a/go/206-Reverse-Linked-List.go b/go/0206-reverse-linked-list.go similarity index 100% rename from go/206-Reverse-Linked-List.go rename to go/0206-reverse-linked-list.go diff --git a/go/207-Course-Schedule.go b/go/0207-course-schedule.go similarity index 100% rename from go/207-Course-Schedule.go rename to go/0207-course-schedule.go diff --git a/go/208-Implement-Trie.go b/go/0208-implement-trie-prefix-tree.go similarity index 100% rename from go/208-Implement-Trie.go rename to go/0208-implement-trie-prefix-tree.go diff --git a/go/213-House-Robber-II.go b/go/0213-house-robber-ii.go similarity index 100% rename from go/213-House-Robber-II.go rename to go/0213-house-robber-ii.go diff --git a/go/217-Contains-Duplicate.go b/go/0217-contains-duplicate.go similarity index 100% rename from go/217-Contains-Duplicate.go rename to go/0217-contains-duplicate.go diff --git a/go/225-Implement-Stack-using-Queues.go b/go/0225-implement-stack-using-queues.go similarity index 100% rename from go/225-Implement-Stack-using-Queues.go rename to go/0225-implement-stack-using-queues.go diff --git a/go/226-Invert-Binary-Tree.go b/go/0226-invert-binary-tree.go similarity index 100% rename from go/226-Invert-Binary-Tree.go rename to go/0226-invert-binary-tree.go diff --git a/go/230-Kth-Smallest-Element-in-a-BST.go b/go/0230-kth-smallest-element-in-a-bst.go similarity index 100% rename from go/230-Kth-Smallest-Element-in-a-BST.go rename to go/0230-kth-smallest-element-in-a-bst.go diff --git a/go/235-Lowest-Common-Ancestor-Of-BST.go b/go/0235-lowest-common-ancestor-of-a-binary-search-tree.go similarity index 100% rename from go/235-Lowest-Common-Ancestor-Of-BST.go rename to go/0235-lowest-common-ancestor-of-a-binary-search-tree.go diff --git a/go/238-Product-Of-Array-Except-Self.go b/go/0238-product-of-array-except-self.go similarity index 100% rename from go/238-Product-Of-Array-Except-Self.go rename to go/0238-product-of-array-except-self.go diff --git a/go/239-Sliding-Window-Maximum.go b/go/0239-sliding-window-maximum.go similarity index 100% rename from go/239-Sliding-Window-Maximum.go rename to go/0239-sliding-window-maximum.go diff --git a/go/242-Valid-Anagram.go b/go/0242-valid-anagram.go similarity index 100% rename from go/242-Valid-Anagram.go rename to go/0242-valid-anagram.go diff --git a/go/268-Missing-Number.go b/go/0268-missing-number.go similarity index 100% rename from go/268-Missing-Number.go rename to go/0268-missing-number.go diff --git a/go/271-Encode-And-Decode-Strings.go b/go/0271-encode-and-decode-strings.go similarity index 100% rename from go/271-Encode-And-Decode-Strings.go rename to go/0271-encode-and-decode-strings.go diff --git a/go/287-Find-the-Duplicate-Number.go b/go/0287-find-the-duplicate-number.go similarity index 100% rename from go/287-Find-the-Duplicate-Number.go rename to go/0287-find-the-duplicate-number.go diff --git a/go/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.go b/go/0309-best-time-to-buy-and-sell-stock-with-cooldown.go similarity index 100% rename from go/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.go rename to go/0309-best-time-to-buy-and-sell-stock-with-cooldown.go diff --git a/go/323-Number-of-Connected-Components-in-an-Undirected-Graph.go b/go/0323-number-of-connected-components-in-an-undirected-graph.go similarity index 100% rename from go/323-Number-of-Connected-Components-in-an-Undirected-Graph.go rename to go/0323-number-of-connected-components-in-an-undirected-graph.go diff --git a/go/338-Counting-Bits.go b/go/0338-counting-bits.go similarity index 100% rename from go/338-Counting-Bits.go rename to go/0338-counting-bits.go diff --git a/go/347-Top-K-Frequent-Elements.go b/go/0347-top-k-frequent-elements.go similarity index 100% rename from go/347-Top-K-Frequent-Elements.go rename to go/0347-top-k-frequent-elements.go diff --git a/go/371-Sum-of-Two-Integers.go b/go/0371-sum-of-two-integers.go similarity index 100% rename from go/371-Sum-of-Two-Integers.go rename to go/0371-sum-of-two-integers.go diff --git a/go/392-Is-Subsequence.go b/go/0392-is-subsequence.go similarity index 100% rename from go/392-Is-Subsequence.go rename to go/0392-is-subsequence.go diff --git a/go/424-Longest-Repeating-Character-Replacement.go b/go/0424-longest-repeating-character-replacement.go similarity index 100% rename from go/424-Longest-Repeating-Character-Replacement.go rename to go/0424-longest-repeating-character-replacement.go diff --git a/go/435-Non-Overlapping-Intervals.go b/go/0435-non-overlapping-intervals.go similarity index 100% rename from go/435-Non-Overlapping-Intervals.go rename to go/0435-non-overlapping-intervals.go diff --git a/go/494-Target-Sum.go b/go/0494-target-sum.go similarity index 100% rename from go/494-Target-Sum.go rename to go/0494-target-sum.go diff --git a/go/543-Diameter-of-Binary-Tree.go b/go/0543-diameter-of-binary-tree.go similarity index 100% rename from go/543-Diameter-of-Binary-Tree.go rename to go/0543-diameter-of-binary-tree.go diff --git a/go/567-Permutation-In-String.go b/go/0567-permutation-in-string.go similarity index 100% rename from go/567-Permutation-In-String.go rename to go/0567-permutation-in-string.go diff --git a/go/572-Subtree-of-Another-Tree.go b/go/0572-subtree-of-another-tree.go similarity index 100% rename from go/572-Subtree-of-Another-Tree.go rename to go/0572-subtree-of-another-tree.go diff --git a/go/684-Redundant-Connection.go b/go/0684-redundant-connection.go similarity index 100% rename from go/684-Redundant-Connection.go rename to go/0684-redundant-connection.go diff --git a/go/695-Max-Area-Of-Island.go b/go/0695-max-area-of-island.go similarity index 100% rename from go/695-Max-Area-Of-Island.go rename to go/0695-max-area-of-island.go diff --git a/go/704-Binary-Search.go b/go/0704-binary-search.go similarity index 100% rename from go/704-Binary-Search.go rename to go/0704-binary-search.go diff --git a/go/739-Daily-Temperatures.go b/go/0739-daily-temperatures.go similarity index 100% rename from go/739-Daily-Temperatures.go rename to go/0739-daily-temperatures.go diff --git a/go/746-Min-Cost-Climbing-Stairs.go b/go/0746-min-cost-climbing-stairs.go similarity index 100% rename from go/746-Min-Cost-Climbing-Stairs.go rename to go/0746-min-cost-climbing-stairs.go diff --git a/go/763-Partition-Labels.go b/go/0763-partition-labels.go similarity index 100% rename from go/763-Partition-Labels.go rename to go/0763-partition-labels.go diff --git a/go/787-Cheapest-Flights-Within-K-Stops.go b/go/0787-cheapest-flights-within-k-stops.go similarity index 100% rename from go/787-Cheapest-Flights-Within-K-Stops.go rename to go/0787-cheapest-flights-within-k-stops.go diff --git a/go/853-Car-Fleet.go b/go/0853-car-fleet.go similarity index 100% rename from go/853-Car-Fleet.go rename to go/0853-car-fleet.go diff --git a/go/875-Koko-Eating-Bananas.go b/go/0875-koko-eating-bananas.go similarity index 100% rename from go/875-Koko-Eating-Bananas.go rename to go/0875-koko-eating-bananas.go diff --git a/go/981-Time-Based-Key-Value-Store.go b/go/0981-time-based-key-value-store.go similarity index 100% rename from go/981-Time-Based-Key-Value-Store.go rename to go/0981-time-based-key-value-store.go diff --git a/go/1143-longest-common-subsequence.go b/go/1143-longest-common-subsequence.go new file mode 100644 index 000000000..286ea9935 --- /dev/null +++ b/go/1143-longest-common-subsequence.go @@ -0,0 +1,26 @@ +func longestCommonSubsequence(text1 string, text2 string) int { + dp := make([][]int, len(text1) + 1) + + for i := 0; i < len(dp); i++ { + dp[i] = make([]int, len(text2) + 1) + } + + for i := len(text1) - 1; i >= 0; i-- { + for j := len(text2) - 1; j >= 0; j-- { + if text1[i] == text2[j] { + dp[i][j] = 1 + dp[i + 1][j + 1] + } else { + dp[i][j] = max(dp[i][j + 1], dp[i + 1][j]) + } + } + } + return dp[0][0] +} + +func max(a, b int) int { + if a > b { + return a + } + + return b +} diff --git a/go/1299-replace-elements-with-greatest-element-on-right-side.go b/go/1299-replace-elements-with-greatest-element-on-right-side.go new file mode 100644 index 000000000..3f3afa24f --- /dev/null +++ b/go/1299-replace-elements-with-greatest-element-on-right-side.go @@ -0,0 +1,16 @@ +func findMaxElement(rightMax int, lastElement int) int { + if lastElement > rightMax { + rightMax = lastElement + } + return rightMax +} + +func replaceElements(arr []int) []int { + var rightMax int = -1 + for i := len(arr) - 1; i >= 0; i-- { + var newMax int = findMaxElement(rightMax, arr[i]) + arr[i] = rightMax + rightMax = newMax + } + return arr +} diff --git a/go/1448-Count-Good-Nodes-in-BT.go b/go/1448-count-good-nodes-in-binary-tree.go similarity index 100% rename from go/1448-Count-Good-Nodes-in-BT.go rename to go/1448-count-good-nodes-in-binary-tree.go diff --git a/java/1-Two-Sum.java b/java/0001-two-sum.java similarity index 100% rename from java/1-Two-Sum.java rename to java/0001-two-sum.java diff --git a/java/2-Add-Two-Numbers.java b/java/0002-add-two-numbers.java similarity index 100% rename from java/2-Add-Two-Numbers.java rename to java/0002-add-two-numbers.java diff --git a/java/3-Longest-Substring-Without-Repeating-Characters.java b/java/0003-longest-substring-without-repeating-characters.java similarity index 100% rename from java/3-Longest-Substring-Without-Repeating-Characters.java rename to java/0003-longest-substring-without-repeating-characters.java diff --git a/java/4-Median-of-Two-Sorted-Arrays.java b/java/0004-median-of-two-sorted-arrays.java similarity index 100% rename from java/4-Median-of-Two-Sorted-Arrays.java rename to java/0004-median-of-two-sorted-arrays.java diff --git a/java/5-Longest-Palindromic-Substring.java b/java/0005-longest-palindromic-substring.java similarity index 100% rename from java/5-Longest-Palindromic-Substring.java rename to java/0005-longest-palindromic-substring.java diff --git a/java/6-Zigzag-Conversion.java b/java/0006-zigzag-conversion.java similarity index 100% rename from java/6-Zigzag-Conversion.java rename to java/0006-zigzag-conversion.java diff --git a/java/7-Reverse-Integer.java b/java/0007-reverse-integer.java similarity index 100% rename from java/7-Reverse-Integer.java rename to java/0007-reverse-integer.java diff --git a/java/10-Regular-Expression-Matching.java b/java/0010-regular-expression-matching.java similarity index 100% rename from java/10-Regular-Expression-Matching.java rename to java/0010-regular-expression-matching.java diff --git a/java/11-Container-With-Most-Water.java b/java/0011-container-with-most-water.java similarity index 100% rename from java/11-Container-With-Most-Water.java rename to java/0011-container-with-most-water.java diff --git a/java/15-3Sum.java b/java/0015-3sum.java similarity index 100% rename from java/15-3Sum.java rename to java/0015-3sum.java diff --git a/java/17-Letter-Combinations-of-a-Phone-Number.java b/java/0017-letter-combinations-of-a-phone-number.java similarity index 100% rename from java/17-Letter-Combinations-of-a-Phone-Number.java rename to java/0017-letter-combinations-of-a-phone-number.java diff --git a/java/19-Remove-Nth-Node-From-End-of-List.java b/java/0019-remove-nth-node-from-end-of-list.java similarity index 100% rename from java/19-Remove-Nth-Node-From-End-of-List.java rename to java/0019-remove-nth-node-from-end-of-list.java diff --git a/java/20-Valid-Parentheses.java b/java/0020-valid-parentheses.java similarity index 100% rename from java/20-Valid-Parentheses.java rename to java/0020-valid-parentheses.java diff --git a/java/21-Merge-Two-Sorted-Lists.java b/java/0021-merge-two-sorted-lists.java similarity index 100% rename from java/21-Merge-Two-Sorted-Lists.java rename to java/0021-merge-two-sorted-lists.java diff --git a/java/22-Generate-Parentheses.java b/java/0022-generate-parentheses.java similarity index 100% rename from java/22-Generate-Parentheses.java rename to java/0022-generate-parentheses.java diff --git a/java/23-Merge-k-Sorted-Lists.java b/java/0023-merge-k-sorted-lists.java similarity index 100% rename from java/23-Merge-k-Sorted-Lists.java rename to java/0023-merge-k-sorted-lists.java diff --git a/java/25-Reverse-Nodes-in-k-Group.java b/java/0025-reverse-nodes-in-k-group.java similarity index 100% rename from java/25-Reverse-Nodes-in-k-Group.java rename to java/0025-reverse-nodes-in-k-group.java diff --git a/java/27-Remove-Element.java b/java/0027-remove-element.java similarity index 100% rename from java/27-Remove-Element.java rename to java/0027-remove-element.java diff --git a/java/33-Search-In-Rotated-Sorted-Array.java b/java/0033-search-in-rotated-sorted-array.java similarity index 100% rename from java/33-Search-In-Rotated-Sorted-Array.java rename to java/0033-search-in-rotated-sorted-array.java diff --git a/java/36-Valid-Sudoku.java b/java/0036-valid-sudoku.java similarity index 100% rename from java/36-Valid-Sudoku.java rename to java/0036-valid-sudoku.java diff --git a/java/39-Combination-Sum.java b/java/0039-combination-sum.java similarity index 100% rename from java/39-Combination-Sum.java rename to java/0039-combination-sum.java diff --git a/java/40-Combination-Sum-II.java b/java/0040-combination-sum-ii.java similarity index 100% rename from java/40-Combination-Sum-II.java rename to java/0040-combination-sum-ii.java diff --git a/java/42-Trapping-Rain-Water.java b/java/0042-trapping-rain-water.java similarity index 100% rename from java/42-Trapping-Rain-Water.java rename to java/0042-trapping-rain-water.java diff --git a/java/43-Multiply-Strings.java b/java/0043-multiply-strings.java similarity index 100% rename from java/43-Multiply-Strings.java rename to java/0043-multiply-strings.java diff --git a/java/45-Jump-game-II.java b/java/0045-jump-game-ii.java similarity index 100% rename from java/45-Jump-game-II.java rename to java/0045-jump-game-ii.java diff --git a/java/46-Permutations.java b/java/0046-permutations.java similarity index 100% rename from java/46-Permutations.java rename to java/0046-permutations.java diff --git a/java/48-Rotate-Image.java b/java/0048-rotate-image.java similarity index 100% rename from java/48-Rotate-Image.java rename to java/0048-rotate-image.java diff --git a/java/49-Group-Anagrams.java b/java/0049-group-anagrams.java similarity index 100% rename from java/49-Group-Anagrams.java rename to java/0049-group-anagrams.java diff --git a/java/50-Pow(x, n).java b/java/0050-powx-n.java similarity index 100% rename from java/50-Pow(x, n).java rename to java/0050-powx-n.java diff --git a/java/51-N-Queens.java b/java/0051-n-queens.java similarity index 100% rename from java/51-N-Queens.java rename to java/0051-n-queens.java diff --git a/java/53-Maximum-Subarray.java b/java/0053-maximum-subarray.java similarity index 100% rename from java/53-Maximum-Subarray.java rename to java/0053-maximum-subarray.java diff --git a/java/54-Spiral-Matrix.java b/java/0054-spiral-matrix.java similarity index 100% rename from java/54-Spiral-Matrix.java rename to java/0054-spiral-matrix.java diff --git a/java/55-Jump-Game.java b/java/0055-jump-game.java similarity index 100% rename from java/55-Jump-Game.java rename to java/0055-jump-game.java diff --git a/java/56-Merge-Intervals.java b/java/0056-merge-intervals.java similarity index 100% rename from java/56-Merge-Intervals.java rename to java/0056-merge-intervals.java diff --git a/java/57-Insert-Interval.java b/java/0057-insert-interval.java similarity index 100% rename from java/57-Insert-Interval.java rename to java/0057-insert-interval.java diff --git a/java/58-Length-Of-Last-Word.java b/java/0058-length-of-last-word.java similarity index 100% rename from java/58-Length-Of-Last-Word.java rename to java/0058-length-of-last-word.java diff --git a/java/62-Unique-Paths.java b/java/0062-unique-paths.java similarity index 100% rename from java/62-Unique-Paths.java rename to java/0062-unique-paths.java diff --git a/java/64-Minimum-Path-Sum.java b/java/0064-minimum-path-sum.java similarity index 100% rename from java/64-Minimum-Path-Sum.java rename to java/0064-minimum-path-sum.java diff --git a/java/66-Plus-One.java b/java/0066-plus-one.java similarity index 100% rename from java/66-Plus-One.java rename to java/0066-plus-one.java diff --git a/java/70-Climbing-Stairs.java b/java/0070-climbing-stairs.java similarity index 100% rename from java/70-Climbing-Stairs.java rename to java/0070-climbing-stairs.java diff --git a/java/72-Edit-Distance.java b/java/0072-edit-distance.java similarity index 100% rename from java/72-Edit-Distance.java rename to java/0072-edit-distance.java diff --git a/java/73-Set-Matrix-Zeroes.java b/java/0073-set-matrix-zeroes.java similarity index 100% rename from java/73-Set-Matrix-Zeroes.java rename to java/0073-set-matrix-zeroes.java diff --git a/java/74-Search-A-2D-Matrix.java b/java/0074-search-a-2d-matrix.java similarity index 100% rename from java/74-Search-A-2D-Matrix.java rename to java/0074-search-a-2d-matrix.java diff --git a/java/75-Sort-Colors.java b/java/0075-sort-colors.java similarity index 100% rename from java/75-Sort-Colors.java rename to java/0075-sort-colors.java diff --git a/java/76-Minimum-Window-Substring.java b/java/0076-minimum-window-substring.java similarity index 100% rename from java/76-Minimum-Window-Substring.java rename to java/0076-minimum-window-substring.java diff --git a/java/78-Subsets.java b/java/0078-subsets.java similarity index 100% rename from java/78-Subsets.java rename to java/0078-subsets.java diff --git a/java/79-Word-Search.java b/java/0079-word-search.java similarity index 100% rename from java/79-Word-Search.java rename to java/0079-word-search.java diff --git a/java/84-Largest-Rectangle-in-Histogram.java b/java/0084-largest-rectangle-in-histogram.java similarity index 100% rename from java/84-Largest-Rectangle-in-Histogram.java rename to java/0084-largest-rectangle-in-histogram.java diff --git a/java/88-Merge-Sorted-Array.java b/java/0088-merge-sorted-array.java similarity index 100% rename from java/88-Merge-Sorted-Array.java rename to java/0088-merge-sorted-array.java diff --git a/java/90-Subsets-II.java b/java/0090-subsets-ii.java similarity index 100% rename from java/90-Subsets-II.java rename to java/0090-subsets-ii.java diff --git a/java/91-Decode-Ways.java b/java/0091-decode-ways.java similarity index 100% rename from java/91-Decode-Ways.java rename to java/0091-decode-ways.java diff --git a/java/97-Interleaving-String.java b/java/0097-interleaving-string.java similarity index 100% rename from java/97-Interleaving-String.java rename to java/0097-interleaving-string.java diff --git a/java/98-Validate-Binary-Search-Tree.java b/java/0098-validate-binary-search-tree.java similarity index 100% rename from java/98-Validate-Binary-Search-Tree.java rename to java/0098-validate-binary-search-tree.java diff --git a/java/100-Same-Tree.java b/java/0100-same-tree.java similarity index 100% rename from java/100-Same-Tree.java rename to java/0100-same-tree.java diff --git a/java/102-Binary-Tree-Level-Order-Traversal.java b/java/0102-binary-tree-level-order-traversal.java similarity index 100% rename from java/102-Binary-Tree-Level-Order-Traversal.java rename to java/0102-binary-tree-level-order-traversal.java diff --git a/java/104-Maximum-Depth-of-Binary-Tree.java b/java/0104-maximum-depth-of-binary-tree.java similarity index 100% rename from java/104-Maximum-Depth-of-Binary-Tree.java rename to java/0104-maximum-depth-of-binary-tree.java diff --git a/java/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.java b/java/0105-construct-binary-tree-from-preorder-and-inorder-traversal.java similarity index 100% rename from java/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.java rename to java/0105-construct-binary-tree-from-preorder-and-inorder-traversal.java diff --git a/java/110-Balanced-Binary-Tree.java b/java/0110-balanced-binary-tree.java similarity index 100% rename from java/110-Balanced-Binary-Tree.java rename to java/0110-balanced-binary-tree.java diff --git a/java/115-Distinct-Subsequences.java b/java/0115-distinct-subsequences.java similarity index 100% rename from java/115-Distinct-Subsequences.java rename to java/0115-distinct-subsequences.java diff --git a/java/118-Pascals-Triangle.java b/java/0118-pascals-triangle.java similarity index 100% rename from java/118-Pascals-Triangle.java rename to java/0118-pascals-triangle.java diff --git a/java/120-Triangle.java b/java/0120-triangle.java similarity index 100% rename from java/120-Triangle.java rename to java/0120-triangle.java diff --git a/java/121-Best-Time-to-Buy-and-Sell-Stock.java b/java/0121-best-time-to-buy-and-sell-stock.java similarity index 100% rename from java/121-Best-Time-to-Buy-and-Sell-Stock.java rename to java/0121-best-time-to-buy-and-sell-stock.java diff --git a/java/124-Binary-Tree-Maximum-Path-Sum.java b/java/0124-binary-tree-maximum-path-sum.java similarity index 100% rename from java/124-Binary-Tree-Maximum-Path-Sum.java rename to java/0124-binary-tree-maximum-path-sum.java diff --git a/java/125-Valid-Palindrome.java b/java/0125-valid-palindrome.java similarity index 100% rename from java/125-Valid-Palindrome.java rename to java/0125-valid-palindrome.java diff --git a/java/127-Word-Ladder.java b/java/0127-word-ladder.java similarity index 100% rename from java/127-Word-Ladder.java rename to java/0127-word-ladder.java diff --git a/java/128-Longest-Consecutive-Sequence.java b/java/0128-longest-consecutive-sequence.java similarity index 100% rename from java/128-Longest-Consecutive-Sequence.java rename to java/0128-longest-consecutive-sequence.java diff --git a/java/130-Surrounded-Regions.java b/java/0130-surrounded-regions.java similarity index 100% rename from java/130-Surrounded-Regions.java rename to java/0130-surrounded-regions.java diff --git a/java/131-Palindrome-Partitioning.java b/java/0131-palindrome-partitioning.java similarity index 100% rename from java/131-Palindrome-Partitioning.java rename to java/0131-palindrome-partitioning.java diff --git a/java/133-Clone-Graph.java b/java/0133-clone-graph.java similarity index 100% rename from java/133-Clone-Graph.java rename to java/0133-clone-graph.java diff --git a/java/134-Gas-Station.java b/java/0134-gas-station.java similarity index 100% rename from java/134-Gas-Station.java rename to java/0134-gas-station.java diff --git a/java/136-Single-Number.java b/java/0136-single-number.java similarity index 100% rename from java/136-Single-Number.java rename to java/0136-single-number.java diff --git a/java/138-Copy-List-with-Random-Pointer.java b/java/0138-copy-list-with-random-pointer.java similarity index 100% rename from java/138-Copy-List-with-Random-Pointer.java rename to java/0138-copy-list-with-random-pointer.java diff --git a/java/139-Word- Break.java b/java/0139-word-break.java similarity index 100% rename from java/139-Word- Break.java rename to java/0139-word-break.java diff --git a/java/143-Reorder-List.java b/java/0143-reorder-list.java similarity index 100% rename from java/143-Reorder-List.java rename to java/0143-reorder-list.java diff --git a/java/146-LRU-Cache.java b/java/0146-lru-cache.java similarity index 100% rename from java/146-LRU-Cache.java rename to java/0146-lru-cache.java diff --git a/java/150-Evaluate-Reverse-Polish-Notation.java b/java/0150-evaluate-reverse-polish-notation.java similarity index 100% rename from java/150-Evaluate-Reverse-Polish-Notation.java rename to java/0150-evaluate-reverse-polish-notation.java diff --git a/java/152-Maximum-Product-Subarray.java b/java/0152-maximum-product-subarray.java similarity index 100% rename from java/152-Maximum-Product-Subarray.java rename to java/0152-maximum-product-subarray.java diff --git a/java/153-Find-Minimum-in-Rotated-Sorted-Array.java b/java/0153-find-minimum-in-rotated-sorted-array.java similarity index 100% rename from java/153-Find-Minimum-in-Rotated-Sorted-Array.java rename to java/0153-find-minimum-in-rotated-sorted-array.java diff --git a/java/155-Min-Stack.java b/java/0155-min-stack.java similarity index 100% rename from java/155-Min-Stack.java rename to java/0155-min-stack.java diff --git a/java/167-Two-Sum-II.java b/java/0167-two-sum-ii-input-array-is-sorted.java similarity index 100% rename from java/167-Two-Sum-II.java rename to java/0167-two-sum-ii-input-array-is-sorted.java diff --git a/java/173-Binary-Search-Tree-Iterator.java b/java/0173-binary-search-tree-iterator.java similarity index 100% rename from java/173-Binary-Search-Tree-Iterator.java rename to java/0173-binary-search-tree-iterator.java diff --git a/java/187-Repeated-DNA-Sequences.java b/java/0187-repeated-dna-sequences.java similarity index 100% rename from java/187-Repeated-DNA-Sequences.java rename to java/0187-repeated-dna-sequences.java diff --git a/java/190-Reverse-Bits.java b/java/0190-reverse-bits.java similarity index 100% rename from java/190-Reverse-Bits.java rename to java/0190-reverse-bits.java diff --git a/java/191-Number-of-1-Bits.java b/java/0191-number-of-1-bits.java similarity index 100% rename from java/191-Number-of-1-Bits.java rename to java/0191-number-of-1-bits.java diff --git a/java/198-House-Robber.java b/java/0198-house-robber.java similarity index 100% rename from java/198-House-Robber.java rename to java/0198-house-robber.java diff --git a/java/199-Binary-Tree-Right-Side-View.java b/java/0199-binary-tree-right-side-view.java similarity index 100% rename from java/199-Binary-Tree-Right-Side-View.java rename to java/0199-binary-tree-right-side-view.java diff --git a/java/200-Number-of-Islands.java b/java/0200-number-of-islands.java similarity index 100% rename from java/200-Number-of-Islands.java rename to java/0200-number-of-islands.java diff --git a/java/202-Happy-Number.java b/java/0202-happy-number.java similarity index 100% rename from java/202-Happy-Number.java rename to java/0202-happy-number.java diff --git a/java/205-Isomorphic-Strings.java b/java/0205-isomorphic-strings.java similarity index 100% rename from java/205-Isomorphic-Strings.java rename to java/0205-isomorphic-strings.java diff --git a/java/207-Course-Schedule.java b/java/0207-course-schedule.java similarity index 100% rename from java/207-Course-Schedule.java rename to java/0207-course-schedule.java diff --git a/java/208-Implement-Trie-Prefix-Tree.java b/java/0208-implement-trie-prefix-tree.java similarity index 100% rename from java/208-Implement-Trie-Prefix-Tree.java rename to java/0208-implement-trie-prefix-tree.java diff --git a/java/210-Course-Schedule-II.java b/java/0210-course-schedule-ii.java similarity index 100% rename from java/210-Course-Schedule-II.java rename to java/0210-course-schedule-ii.java diff --git a/java/211-Design-Add-and-Search-Words-Data-Structure.java b/java/0211-design-add-and-search-words-data-structure.java similarity index 100% rename from java/211-Design-Add-and-Search-Words-Data-Structure.java rename to java/0211-design-add-and-search-words-data-structure.java diff --git a/java/212-Word-Search-II.java b/java/0212-word-search-ii.java similarity index 100% rename from java/212-Word-Search-II.java rename to java/0212-word-search-ii.java diff --git a/java/213-House-Robber-II.java b/java/0213-house-robber-ii.java similarity index 100% rename from java/213-House-Robber-II.java rename to java/0213-house-robber-ii.java diff --git a/java/215-Kth-Largest-Element-in-an-Array.java b/java/0215-kth-largest-element-in-an-array.java similarity index 100% rename from java/215-Kth-Largest-Element-in-an-Array.java rename to java/0215-kth-largest-element-in-an-array.java diff --git a/java/217-Contains-Duplicate.java b/java/0217-contains-duplicate.java similarity index 100% rename from java/217-Contains-Duplicate.java rename to java/0217-contains-duplicate.java diff --git a/java/226-Invert-Binary-Tree.java b/java/0226-invert-binary-tree.java similarity index 100% rename from java/226-Invert-Binary-Tree.java rename to java/0226-invert-binary-tree.java diff --git a/java/230-Kth-Smallest-Element-in-a-BST.java b/java/0230-kth-smallest-element-in-a-bst.java similarity index 100% rename from java/230-Kth-Smallest-Element-in-a-BST.java rename to java/0230-kth-smallest-element-in-a-bst.java diff --git a/java/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.java b/java/0235-lowest-common-ancestor-of-a-binary-search-tree.java similarity index 100% rename from java/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.java rename to java/0235-lowest-common-ancestor-of-a-binary-search-tree.java diff --git a/java/238-Product-of-Array-Except-Self.java b/java/0238-product-of-array-except-self.java similarity index 100% rename from java/238-Product-of-Array-Except-Self.java rename to java/0238-product-of-array-except-self.java diff --git a/java/239-Sliding-Window-Maximum.java b/java/0239-sliding-window-maximum.java similarity index 100% rename from java/239-Sliding-Window-Maximum.java rename to java/0239-sliding-window-maximum.java diff --git a/java/242-Valid-Anagram.java b/java/0242-valid-anagram.java similarity index 100% rename from java/242-Valid-Anagram.java rename to java/0242-valid-anagram.java diff --git a/java/253-Meeting-Rooms-ii.java b/java/0253-meeting-rooms.java similarity index 100% rename from java/253-Meeting-Rooms-ii.java rename to java/0253-meeting-rooms.java diff --git a/java/261-Graph-Valid-Tree.java b/java/0261-graph-valid-tree.java similarity index 100% rename from java/261-Graph-Valid-Tree.java rename to java/0261-graph-valid-tree.java diff --git a/java/268-Missing-Number.java b/java/0268-missing-number.java similarity index 100% rename from java/268-Missing-Number.java rename to java/0268-missing-number.java diff --git a/java/269-Alien-Dictionary.java b/java/0269-alien-dictionary.java similarity index 100% rename from java/269-Alien-Dictionary.java rename to java/0269-alien-dictionary.java diff --git a/java/271-Encode-and-Decode-Strings.java b/java/0271-encode-and-decode-strings.java similarity index 100% rename from java/271-Encode-and-Decode-Strings.java rename to java/0271-encode-and-decode-strings.java diff --git a/java/279-Perfect-Squares.java b/java/0279-perfect-squares.java similarity index 100% rename from java/279-Perfect-Squares.java rename to java/0279-perfect-squares.java diff --git a/java/286-Walls-and-Gates.java b/java/0286-walls-and-gates.java similarity index 100% rename from java/286-Walls-and-Gates.java rename to java/0286-walls-and-gates.java diff --git a/java/287-Find-the-Duplicate-Number.java b/java/0287-find-the-duplicate-number.java similarity index 100% rename from java/287-Find-the-Duplicate-Number.java rename to java/0287-find-the-duplicate-number.java diff --git a/java/290-word-pattern b/java/0290-word-pattern.java similarity index 100% rename from java/290-word-pattern rename to java/0290-word-pattern.java diff --git a/java/295-Find-Median-from-Data-Stream.java b/java/0295-find-median-from-data-stream.java similarity index 100% rename from java/295-Find-Median-from-Data-Stream.java rename to java/0295-find-median-from-data-stream.java diff --git a/java/297-Serialize-and-Deserialize-Binary-Tree.java b/java/0297-serialize-and-deserialize-binary-tree.java similarity index 100% rename from java/297-Serialize-and-Deserialize-Binary-Tree.java rename to java/0297-serialize-and-deserialize-binary-tree.java diff --git a/java/300-Longest-Increasing-Subsequence.java b/java/0300-longest-increasing-subsequence.java similarity index 100% rename from java/300-Longest-Increasing-Subsequence.java rename to java/0300-longest-increasing-subsequence.java diff --git a/java/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.java b/java/0309-best-time-to-buy-and-sell-stock-with-cooldown.java similarity index 100% rename from java/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.java rename to java/0309-best-time-to-buy-and-sell-stock-with-cooldown.java diff --git a/java/312-Burst-Balloons.java b/java/0312-burst-balloons.java similarity index 100% rename from java/312-Burst-Balloons.java rename to java/0312-burst-balloons.java diff --git a/java/322-Coin-Change.java b/java/0322-coin-change.java similarity index 100% rename from java/322-Coin-Change.java rename to java/0322-coin-change.java diff --git a/java/323-Number-of-Connected-Components-in-an-Undirected-Graph.java b/java/0323-number-of-connected-components-in-an-undirected-graph.java similarity index 100% rename from java/323-Number-of-Connected-Components-in-an-Undirected-Graph.java rename to java/0323-number-of-connected-components-in-an-undirected-graph.java diff --git a/java/329-Longest-Increasing-Path-in-a-Matrix.java b/java/0329-longest-increasing-path-in-a-matrix.java similarity index 100% rename from java/329-Longest-Increasing-Path-in-a-Matrix.java rename to java/0329-longest-increasing-path-in-a-matrix.java diff --git a/java/332-Reconstruct-Itinerary.java b/java/0332-reconstruct-itinerary.java similarity index 100% rename from java/332-Reconstruct-Itinerary.java rename to java/0332-reconstruct-itinerary.java diff --git a/java/338-Counting-Bits.java b/java/0338-counting-bits.java similarity index 100% rename from java/338-Counting-Bits.java rename to java/0338-counting-bits.java diff --git a/java/347-Top-K-Frequent-Elements.java b/java/0347-top-k-frequent-elements.java similarity index 100% rename from java/347-Top-K-Frequent-Elements.java rename to java/0347-top-k-frequent-elements.java diff --git a/java/355-Design-Twitter.java b/java/0355-design-twitter.java similarity index 100% rename from java/355-Design-Twitter.java rename to java/0355-design-twitter.java diff --git a/java/371-Sum-of-Two-Integers.java b/java/0371-sum-of-two-integers.java similarity index 100% rename from java/371-Sum-of-Two-Integers.java rename to java/0371-sum-of-two-integers.java diff --git a/java/380-Insert-Delete-GetRandom-O(1).java b/java/0380-insert-delete-getrandom-o1.java similarity index 100% rename from java/380-Insert-Delete-GetRandom-O(1).java rename to java/0380-insert-delete-getrandom-o1.java diff --git a/java/392-Is-Subsequence.java b/java/0392-is-subsequence.java similarity index 100% rename from java/392-Is-Subsequence.java rename to java/0392-is-subsequence.java diff --git a/java/416-Partition-Equal-Subset-Sum.java b/java/0416-partition-equal-subset-sum.java similarity index 100% rename from java/416-Partition-Equal-Subset-Sum.java rename to java/0416-partition-equal-subset-sum.java diff --git a/java/417-Pacific-Atlantic-Water-Flow.java b/java/0417-pacific-atlantic-water-flow.java similarity index 100% rename from java/417-Pacific-Atlantic-Water-Flow.java rename to java/0417-pacific-atlantic-water-flow.java diff --git a/java/424-Longest-Repeating-Character-Replacement.java b/java/0424-longest-repeating-character-replacement.java similarity index 100% rename from java/424-Longest-Repeating-Character-Replacement.java rename to java/0424-longest-repeating-character-replacement.java diff --git a/java/435-Non-Overlapping-Intervals.java b/java/0435-non-overlapping-intervals.java similarity index 100% rename from java/435-Non-Overlapping-Intervals.java rename to java/0435-non-overlapping-intervals.java diff --git a/java/448-Find-All-Numbers-Disappeared-in-an-Array.java b/java/0448-find-all-numbers-disappeared-in-an-array.java similarity index 100% rename from java/448-Find-All-Numbers-Disappeared-in-an-Array.java rename to java/0448-find-all-numbers-disappeared-in-an-array.java diff --git a/java/494-Target-Sum.java b/java/0494-target-sum.java similarity index 100% rename from java/494-Target-Sum.java rename to java/0494-target-sum.java diff --git a/java/496-Next-Greater-Element-I.java b/java/0496-next-greater-element-i.java similarity index 100% rename from java/496-Next-Greater-Element-I.java rename to java/0496-next-greater-element-i.java diff --git a/java/513-Find-Bottom-Left-Tree-Value.java b/java/0513-find-bottom-left-tree-value.java similarity index 100% rename from java/513-Find-Bottom-Left-Tree-Value.java rename to java/0513-find-bottom-left-tree-value.java diff --git a/java/518-Coin-Change-2.java b/java/0518-coin-change-ii.java similarity index 100% rename from java/518-Coin-Change-2.java rename to java/0518-coin-change-ii.java diff --git a/java/523-Continuous-Subarray-Sum.java b/java/0523-continuous-subarray-sum.java similarity index 100% rename from java/523-Continuous-Subarray-Sum.java rename to java/0523-continuous-subarray-sum.java diff --git a/java/543-Diameter-of-Binary-Tree.java b/java/0543-diameter-of-binary-tree.java similarity index 100% rename from java/543-Diameter-of-Binary-Tree.java rename to java/0543-diameter-of-binary-tree.java diff --git a/java/560-Subarray-Sum-Equals-K.java b/java/0560-subarray-sum-equals-k.java similarity index 100% rename from java/560-Subarray-Sum-Equals-K.java rename to java/0560-subarray-sum-equals-k.java diff --git a/java/567-Permutation-in-String.java b/java/0567-permutation-in-string.java similarity index 100% rename from java/567-Permutation-in-String.java rename to java/0567-permutation-in-string.java diff --git a/java/572-Subtree-of-Another-Tree.java b/java/0572-subtree-of-another-tree.java similarity index 100% rename from java/572-Subtree-of-Another-Tree.java rename to java/0572-subtree-of-another-tree.java diff --git a/java/617-Merge-Two-Binary-Trees.java b/java/0617-merge-two-binary-trees.java similarity index 100% rename from java/617-Merge-Two-Binary-Trees.java rename to java/0617-merge-two-binary-trees.java diff --git a/java/621-Task-Scheduler.java b/java/0621-task-scheduler.java similarity index 100% rename from java/621-Task-Scheduler.java rename to java/0621-task-scheduler.java diff --git a/java/647-Palindromic-Substrings.java b/java/0647-palindromic-substrings.java similarity index 100% rename from java/647-Palindromic-Substrings.java rename to java/0647-palindromic-substrings.java diff --git a/java/678-Valid-Parenthesis-String.java b/java/0678-valid-parenthesis-string.java similarity index 100% rename from java/678-Valid-Parenthesis-String.java rename to java/0678-valid-parenthesis-string.java diff --git a/java/684-Redundant-Connection.java b/java/0684-redundant-connection.java similarity index 100% rename from java/684-Redundant-Connection.java rename to java/0684-redundant-connection.java diff --git a/java/695-Max-Area-of-Island.java b/java/0695-max-area-of-island.java similarity index 100% rename from java/695-Max-Area-of-Island.java rename to java/0695-max-area-of-island.java diff --git a/java/703-Kth-Largest-Element-in-a-Stream.java b/java/0703-kth-largest-element-in-a-stream.java similarity index 100% rename from java/703-Kth-Largest-Element-in-a-Stream.java rename to java/0703-kth-largest-element-in-a-stream.java diff --git a/java/704-Binary-Search.java b/java/0704-binary-search.java similarity index 100% rename from java/704-Binary-Search.java rename to java/0704-binary-search.java diff --git a/java/724-Find-Pivot-Index b/java/0724-find-pivot-index.java similarity index 100% rename from java/724-Find-Pivot-Index rename to java/0724-find-pivot-index.java diff --git a/java/739-Daily-Temperatures.java b/java/0739-daily-temperatures.java similarity index 100% rename from java/739-Daily-Temperatures.java rename to java/0739-daily-temperatures.java diff --git a/java/743-Network-Delay-Time.java b/java/0743-network-delay-time.java similarity index 100% rename from java/743-Network-Delay-Time.java rename to java/0743-network-delay-time.java diff --git a/java/746-Min-Cost-Climbing-Stairs.java b/java/0746-min-cost-climbing-stairs.java similarity index 100% rename from java/746-Min-Cost-Climbing-Stairs.java rename to java/0746-min-cost-climbing-stairs.java diff --git a/java/752-Open-the-lock.java b/java/0752-open-the-lock.java similarity index 100% rename from java/752-Open-the-lock.java rename to java/0752-open-the-lock.java diff --git a/java/763-Partition-Labels.java b/java/0763-partition-labels.java similarity index 100% rename from java/763-Partition-Labels.java rename to java/0763-partition-labels.java diff --git a/java/767-Reorganize-String.java b/java/0767-reorganize-string.java similarity index 100% rename from java/767-Reorganize-String.java rename to java/0767-reorganize-string.java diff --git a/java/778-Swim-in-Rising-Water.java b/java/0778-swim-in-rising-water.java similarity index 100% rename from java/778-Swim-in-Rising-Water.java rename to java/0778-swim-in-rising-water.java diff --git a/java/787-Cheapest-Flights-Within-K-Stops.java b/java/0787-cheapest-flights-within-k-stops.java similarity index 100% rename from java/787-Cheapest-Flights-Within-K-Stops.java rename to java/0787-cheapest-flights-within-k-stops.java diff --git a/java/846-Hand-of-Straights.java b/java/0846-hand-of-straights.java similarity index 100% rename from java/846-Hand-of-Straights.java rename to java/0846-hand-of-straights.java diff --git a/java/853-Car Fleet.java b/java/0853-car-fleet.java similarity index 100% rename from java/853-Car Fleet.java rename to java/0853-car-fleet.java diff --git a/java/875-Koko-Eating-Bananas.java b/java/0875-koko-eating-bananas.java similarity index 100% rename from java/875-Koko-Eating-Bananas.java rename to java/0875-koko-eating-bananas.java diff --git a/java/929-Unique-Email-Addresses.java b/java/0929-unique-email-addresses.java similarity index 100% rename from java/929-Unique-Email-Addresses.java rename to java/0929-unique-email-addresses.java diff --git a/java/973-K-Closest-Points-to-Origin.java b/java/0973-k-closest-points-to-origin.java similarity index 100% rename from java/973-K-Closest-Points-to-Origin.java rename to java/0973-k-closest-points-to-origin.java diff --git a/java/981-Time-Based-Key-Value-Store.java b/java/0981-time-based-key-value-store.java similarity index 100% rename from java/981-Time-Based-Key-Value-Store.java rename to java/0981-time-based-key-value-store.java diff --git a/java/994-Rotting-Oranges.java b/java/0994-rotting-oranges.java similarity index 100% rename from java/994-Rotting-Oranges.java rename to java/0994-rotting-oranges.java diff --git a/java/1046-last-stone-weight.java b/java/1046-last-stone-weight.java new file mode 100644 index 000000000..aa14de0f1 --- /dev/null +++ b/java/1046-last-stone-weight.java @@ -0,0 +1,13 @@ +class Solution { + + public int lastStoneWeight(int[] stones) { + PriorityQueue maxHeap = new PriorityQueue(); + for (int stone : stones) maxHeap.add(-stone); + while (maxHeap.size() > 1) { + int stone1 = maxHeap.remove(); + int stone2 = maxHeap.remove(); + if (stone1 != stone2) maxHeap.add(stone1 - stone2); + } + return maxHeap.size() != 0 ? (-maxHeap.remove()) : 0; + } +} diff --git a/java/1143-longest-common-subsequence.java b/java/1143-longest-common-subsequence.java new file mode 100644 index 000000000..59071919f --- /dev/null +++ b/java/1143-longest-common-subsequence.java @@ -0,0 +1,54 @@ +//memoized version + +class Solution { + + public int longestCommonSubsequence(String text1, String text2) { + int[][] dp = new int[text1.length()][text2.length()]; + return LCS(text1, text2, 0, 0, dp); + } + + public int LCS(String s1, String s2, int i, int j, int[][] dp) { + if (i >= s1.length() || j >= s2.length()) return 0; else if ( + dp[i][j] != 0 + ) return dp[i][j]; else if (s1.charAt(i) == s2.charAt(j)) return ( + 1 + LCS(s1, s2, i + 1, j + 1, dp) + ); else { + dp[i][j] = + Math.max(LCS(s1, s2, i + 1, j, dp), LCS(s1, s2, i, j + 1, dp)); + return dp[i][j]; + } + } +} + +// Iterative version +class Solution { + + public int longestCommonSubsequence(String text1, String text2) { + //O(n*m)/O(n*m) time/memory + if (text1.isEmpty() || text2.isEmpty()) { + return 0; + } + + int[][] dp = new int[text1.length() + 1][text2.length() + 1]; + + for (int i = 0; i <= text1.length(); i++) { + dp[i][0] = 0; + } + + for (int j = 0; j <= text2.length(); j++) { + dp[0][j] = 0; + } + + for (int i = 1; i <= text1.length(); i++) { + for (int j = 1; j <= text2.length(); j++) { + if (text1.charAt(i - 1) == text2.charAt(j - 1)) { + dp[i][j] = 1 + dp[i - 1][j - 1]; + } else { + dp[i][j] = Math.max(dp[i][j - 1], dp[i - 1][j]); + } + } + } + + return dp[text1.length()][text2.length()]; + } +} diff --git a/java/1189-Maximum-Number-of-Balloons b/java/1189-maximum-number-of-balloons.java similarity index 100% rename from java/1189-Maximum-Number-of-Balloons rename to java/1189-maximum-number-of-balloons.java diff --git a/java/1299-replace-elements-with-greatest-element-on-right-side.java b/java/1299-replace-elements-with-greatest-element-on-right-side.java new file mode 100644 index 000000000..e8b324338 --- /dev/null +++ b/java/1299-replace-elements-with-greatest-element-on-right-side.java @@ -0,0 +1,11 @@ +class Solution { + public int[] replaceElements(int[] arr) { + int rightMax = -1; + for (int i = arr.length - 1; i >= 0; i--) { + int newMax = Math.max(rightMax, arr[i]); + arr[i] = rightMax; + rightMax = newMax; + } + return arr; + } +} diff --git a/java/1448-count-good-nodes-in-binary-tree.java b/java/1448-count-good-nodes-in-binary-tree.java new file mode 100644 index 000000000..52644a4ac --- /dev/null +++ b/java/1448-count-good-nodes-in-binary-tree.java @@ -0,0 +1,17 @@ +class Solution { + + public int goodNodes(TreeNode root) { + return helper(root, -99999); + } + + public int helper(TreeNode root, int max) { + if (root == null) return 0; + + int res = root.val >= max ? 1 : 0; + + res += helper(root.left, Math.max(root.val, max)); + res += helper(root.right, Math.max(root.val, max)); + + return res; + } +} diff --git a/java/1584-min-cost-to-connect-all-points.java b/java/1584-min-cost-to-connect-all-points.java new file mode 100644 index 000000000..f97cc6e20 --- /dev/null +++ b/java/1584-min-cost-to-connect-all-points.java @@ -0,0 +1,36 @@ +class Solution { + + // Time Complexity: O(N^2 log(N)) where N is the length of points. N^2 comes from the fact we need to find the distance between a currNode and every other node to pick the shortest distance. log(N) comes from Priority Queue + // Space Complexity: O(N^2) + public int minCostConnectPoints(int[][] points) { + PriorityQueue pq = new PriorityQueue<>((a, b) -> a[0] - b[0]); // edge weight, the index of next node + pq.offer(new int[] { 0, 0 }); + int len = points.length; + Set visited = new HashSet<>(); + int cost = 0; + + // When visited.size() == points.len meaning that all the nodes has been connected. + while (visited.size() < len) { + int[] arr = pq.poll(); + + int weight = arr[0]; + int currNode = arr[1]; + + if (visited.contains(currNode)) continue; + + visited.add(currNode); + cost += weight; + + for (int nextNode = 0; nextNode < len; nextNode++) { + if (!visited.contains(nextNode)) { + int nextWeight = + Math.abs(points[nextNode][0] - points[currNode][0]) + + Math.abs(points[nextNode][1] - points[currNode][1]); + pq.offer(new int[] { nextWeight, nextNode }); + } + } + } + + return cost; + } +} diff --git a/java/1851-minimum-interval-to-include-each-query.java b/java/1851-minimum-interval-to-include-each-query.java new file mode 100644 index 000000000..e1a99ce15 --- /dev/null +++ b/java/1851-minimum-interval-to-include-each-query.java @@ -0,0 +1,92 @@ +class Query { + + int index; + int queryTimeStamp; + int result; + + public Query(int index, int queryTimeStamp) { + this.index = index; + this.queryTimeStamp = queryTimeStamp; + this.result = -1; // initially store as -1 + } + + @Override + public String toString() { + return "[" + index + "," + queryTimeStamp + "," + result + "]"; + } + + public void setResult(int result) { + this.result = result; + } +} + +class IntervalComparator implements Comparator { + + public static int getSize(int[] interval) { + return (interval[1] - interval[0] + 1); + } + + @Override + public int compare(int[] o1, int[] o2) { + int o1Size = getSize(o1), o2Size = getSize(o2); + if (o1Size != o2Size) { + return (o1Size - o2Size); + } + return (o1[1] - o2[1]); + } +} + +class Solution { + + public int[] minInterval(int[][] intervals, int[] queries) { + // book-keeping & sorting + int numIntervals = intervals.length; + int numQueries = queries.length; + + // Sort by start times + Arrays.sort(intervals, (o1, o2) -> (o1[0] - o2[0])); + + Query[] sortedQueries = new Query[numQueries]; + for (int i = 0; i < numQueries; i++) sortedQueries[i] = + new Query(i, queries[i]); + + Arrays.sort( + sortedQueries, + (q1, q2) -> (q1.queryTimeStamp - q2.queryTimeStamp) + ); + + // algorithm + + Comparator comparator = new IntervalComparator(); + PriorityQueue pq = new PriorityQueue<>(comparator); + int idx = 0; + + for (Query query : sortedQueries) { + // 1. Keep taking all those queries which have lower starting time than the query time and add them to priority queue + while ( + (idx < numIntervals) && + (query.queryTimeStamp >= intervals[idx][0]) + ) { + pq.add(intervals[idx]); + idx++; + } + + // 2. Keep removing the inconsistent intervals and get the min size interval from priority queue + while (!pq.isEmpty() && (pq.peek()[1] < query.queryTimeStamp)) { + pq.remove(); + } + + // Now, priority queue must have the consistent & smallest interval + int ans = pq.isEmpty() ? -1 : IntervalComparator.getSize(pq.peek()); + query.setResult(ans); + } + + // reconversion + int[] results = new int[numQueries]; + for (Query query : sortedQueries) { + results[query.index] = query.result; + } + + return results; + } +} diff --git a/java/1985-find-the-kth-largest-integer-in-the-array.java b/java/1985-find-the-kth-largest-integer-in-the-array.java new file mode 100644 index 000000000..a32c8f80e --- /dev/null +++ b/java/1985-find-the-kth-largest-integer-in-the-array.java @@ -0,0 +1,32 @@ +// Min Heap comparator for reverse priority queue +class StringNumberComparartor implements Comparator { + @Override + public int compare(String s1, String s2) { + if(s1.length() != s2.length()) { + return (s1.length() - s2.length()); + } + int len = s1.length(); + for(int i=0; i pq = new PriorityQueue<>(new StringNumberComparartor()); + + for(String numStr: nums) { + pq.add(numStr); + if(pq.size() > k) { + pq.remove(); + } + } + + return pq.peek(); + } +} \ No newline at end of file diff --git a/java/2013-detect-squares.java b/java/2013-detect-squares.java new file mode 100644 index 000000000..d6af2d55d --- /dev/null +++ b/java/2013-detect-squares.java @@ -0,0 +1,110 @@ +// https://leetcode.com/submissions/detail/761120641/ +class DetectSquares { + + private Integer[][] matrix; + + public DetectSquares() { + matrix = new Integer[1001][1001]; + } + + public void add(int[] point) { + if (matrix[point[0]][point[1]] == null) { + matrix[point[0]][point[1]] = 1; + } else { + matrix[point[0]][point[1]] = matrix[point[0]][point[1]] + 1; + } + } + + public int count(int[] point) { + int currentSquareCount = 0; + int currentPointCount = 1; + int startRow = point[0]; + int startCol = point[1]; + int curRow = point[0]; + int curCol = point[1]; + + while (curRow != 0 && curCol != 0) { + curRow--; + curCol--; + if ( + matrix[curRow][curCol] != null && + matrix[startRow][curCol] != null && + matrix[curRow][startCol] != null + ) { + currentSquareCount = + currentSquareCount + + ( + currentPointCount * + matrix[curRow][curCol] * + matrix[startRow][curCol] * + matrix[curRow][startCol] + ); + } + } + + curRow = point[0]; + curCol = point[1]; + while (curRow != 1000 && curCol != 1000) { + curRow++; + curCol++; + if ( + matrix[curRow][curCol] != null && + matrix[startRow][curCol] != null && + matrix[curRow][startCol] != null + ) { + currentSquareCount = + currentSquareCount + + ( + currentPointCount * + matrix[curRow][curCol] * + matrix[startRow][curCol] * + matrix[curRow][startCol] + ); + } + } + + curRow = point[0]; + curCol = point[1]; + while (curRow != 0 && curCol != 1000) { + curRow--; + curCol++; + if ( + matrix[curRow][curCol] != null && + matrix[startRow][curCol] != null && + matrix[curRow][startCol] != null + ) { + currentSquareCount = + currentSquareCount + + ( + currentPointCount * + matrix[curRow][curCol] * + matrix[startRow][curCol] * + matrix[curRow][startCol] + ); + } + } + + curRow = point[0]; + curCol = point[1]; + while (curRow != 1000 && curCol != 0) { + curRow++; + curCol--; + if ( + matrix[curRow][curCol] != null && + matrix[startRow][curCol] != null && + matrix[curRow][startCol] != null + ) { + currentSquareCount = + currentSquareCount + + ( + currentPointCount * + matrix[curRow][curCol] * + matrix[startRow][curCol] * + matrix[curRow][startCol] + ); + } + } + + return currentSquareCount; + } +} diff --git a/javascript/1-Two-Sum.js b/javascript/0001-two-sum.js similarity index 100% rename from javascript/1-Two-Sum.js rename to javascript/0001-two-sum.js diff --git a/javascript/2-Add-Two-Numbers.js b/javascript/0002-add-two-numbers.js similarity index 100% rename from javascript/2-Add-Two-Numbers.js rename to javascript/0002-add-two-numbers.js diff --git a/javascript/3-Longest-Substring-Without-Repeating-Characters.js b/javascript/0003-longest-substring-without-repeating-characters.js similarity index 100% rename from javascript/3-Longest-Substring-Without-Repeating-Characters.js rename to javascript/0003-longest-substring-without-repeating-characters.js diff --git a/javascript/4-Median-Of-Two-Sorted-Arrays.js b/javascript/0004-median-of-two-sorted-arrays.js similarity index 100% rename from javascript/4-Median-Of-Two-Sorted-Arrays.js rename to javascript/0004-median-of-two-sorted-arrays.js diff --git a/javascript/5-Longest-Palindromic-Substring.js b/javascript/0005-longest-palindromic-substring.js similarity index 100% rename from javascript/5-Longest-Palindromic-Substring.js rename to javascript/0005-longest-palindromic-substring.js diff --git a/javascript/7-Reverse-Integer.js b/javascript/0007-reverse-integer.js similarity index 100% rename from javascript/7-Reverse-Integer.js rename to javascript/0007-reverse-integer.js diff --git a/javascript/9-Palindrome-Number.js b/javascript/0009-palindrome-number.js similarity index 100% rename from javascript/9-Palindrome-Number.js rename to javascript/0009-palindrome-number.js diff --git a/javascript/10-Regular-Expression-Matching.js b/javascript/0010-regular-expression-matching.js similarity index 100% rename from javascript/10-Regular-Expression-Matching.js rename to javascript/0010-regular-expression-matching.js diff --git a/javascript/11-Container-With-Most-Water.js b/javascript/0011-container-with-most-water.js similarity index 100% rename from javascript/11-Container-With-Most-Water.js rename to javascript/0011-container-with-most-water.js diff --git a/javascript/13-Roman-to-Integer.js b/javascript/0013-roman-to-integer.js similarity index 100% rename from javascript/13-Roman-to-Integer.js rename to javascript/0013-roman-to-integer.js diff --git a/javascript/14-Longest-Common-Prefix.js b/javascript/0014-longest-common-prefix.js similarity index 100% rename from javascript/14-Longest-Common-Prefix.js rename to javascript/0014-longest-common-prefix.js diff --git a/javascript/15-3Sum.js b/javascript/0015-3sum.js similarity index 100% rename from javascript/15-3Sum.js rename to javascript/0015-3sum.js diff --git a/javascript/17-Letter-Combinations-of-a-Phone-Number.js b/javascript/0017-letter-combinations-of-a-phone-number.js similarity index 100% rename from javascript/17-Letter-Combinations-of-a-Phone-Number.js rename to javascript/0017-letter-combinations-of-a-phone-number.js diff --git a/javascript/19-Remove-Nth-Node-From-End-of-List.js b/javascript/0019-remove-nth-node-from-end-of-list.js similarity index 100% rename from javascript/19-Remove-Nth-Node-From-End-of-List.js rename to javascript/0019-remove-nth-node-from-end-of-list.js diff --git a/javascript/20-Valid-Parentheses.js b/javascript/0020-valid-parentheses.js similarity index 100% rename from javascript/20-Valid-Parentheses.js rename to javascript/0020-valid-parentheses.js diff --git a/javascript/21-Merge-Two-Sorted-Lists.js b/javascript/0021-merge-two-sorted-lists.js similarity index 100% rename from javascript/21-Merge-Two-Sorted-Lists.js rename to javascript/0021-merge-two-sorted-lists.js diff --git a/javascript/22-Generate-Parentheses.js b/javascript/0022-generate-parentheses.js similarity index 100% rename from javascript/22-Generate-Parentheses.js rename to javascript/0022-generate-parentheses.js diff --git a/javascript/23-Merge-K-Sorted-Lists.js b/javascript/0023-merge-k-sorted-lists.js similarity index 100% rename from javascript/23-Merge-K-Sorted-Lists.js rename to javascript/0023-merge-k-sorted-lists.js diff --git a/javascript/25-Reverse-Nodes-in-K-Group.js b/javascript/0025-reverse-nodes-in-k-group.js similarity index 100% rename from javascript/25-Reverse-Nodes-in-K-Group.js rename to javascript/0025-reverse-nodes-in-k-group.js diff --git a/javascript/26-Remove-Duplicates-from-Sorted-Array.js b/javascript/0026-remove-duplicates-from-sorted-array.js similarity index 100% rename from javascript/26-Remove-Duplicates-from-Sorted-Array.js rename to javascript/0026-remove-duplicates-from-sorted-array.js diff --git a/javascript/27-Remove-Element.js b/javascript/0027-remove-element.js similarity index 100% rename from javascript/27-Remove-Element.js rename to javascript/0027-remove-element.js diff --git a/javascript/33-Search-in-Rotated-Sorted-Array.js b/javascript/0033-search-in-rotated-sorted-array.js similarity index 100% rename from javascript/33-Search-in-Rotated-Sorted-Array.js rename to javascript/0033-search-in-rotated-sorted-array.js diff --git a/javascript/35-Search-Insert-Position.js b/javascript/0035-search-insert-position.js similarity index 100% rename from javascript/35-Search-Insert-Position.js rename to javascript/0035-search-insert-position.js diff --git a/javascript/36-Valid-Sudoku.js b/javascript/0036-valid-sudoku.js similarity index 100% rename from javascript/36-Valid-Sudoku.js rename to javascript/0036-valid-sudoku.js diff --git a/javascript/39-Combination-Sum.js b/javascript/0039-combination-sum.js similarity index 100% rename from javascript/39-Combination-Sum.js rename to javascript/0039-combination-sum.js diff --git a/javascript/40-Combination-Sum-II.js b/javascript/0040-combination-sum-ii.js similarity index 100% rename from javascript/40-Combination-Sum-II.js rename to javascript/0040-combination-sum-ii.js diff --git a/javascript/42-Trapping-Rain-Water.js b/javascript/0042-trapping-rain-water.js similarity index 100% rename from javascript/42-Trapping-Rain-Water.js rename to javascript/0042-trapping-rain-water.js diff --git a/javascript/43-Multiply-Strings.js b/javascript/0043-multiply-strings.js similarity index 100% rename from javascript/43-Multiply-Strings.js rename to javascript/0043-multiply-strings.js diff --git a/javascript/45-Jump-Game-II.js b/javascript/0045-jump-game-ii.js similarity index 100% rename from javascript/45-Jump-Game-II.js rename to javascript/0045-jump-game-ii.js diff --git a/javascript/46-Permutations.js b/javascript/0046-permutations.js similarity index 100% rename from javascript/46-Permutations.js rename to javascript/0046-permutations.js diff --git a/javascript/48-Rotate-Image.js b/javascript/0048-rotate-image.js similarity index 100% rename from javascript/48-Rotate-Image.js rename to javascript/0048-rotate-image.js diff --git a/javascript/49-Group-Anagrams.js b/javascript/0049-group-anagrams.js similarity index 100% rename from javascript/49-Group-Anagrams.js rename to javascript/0049-group-anagrams.js diff --git a/javascript/51-solveNQueens.js b/javascript/0051-n-queens.js similarity index 100% rename from javascript/51-solveNQueens.js rename to javascript/0051-n-queens.js diff --git a/javascript/52-totalNQueens.js b/javascript/0052-n-queens-ii.js similarity index 100% rename from javascript/52-totalNQueens.js rename to javascript/0052-n-queens-ii.js diff --git a/javascript/53-Maximum-Subarray.js b/javascript/0053-maximum-subarray.js similarity index 100% rename from javascript/53-Maximum-Subarray.js rename to javascript/0053-maximum-subarray.js diff --git a/javascript/54-Spiral-Matrix.js b/javascript/0054-spiral-matrix.js similarity index 100% rename from javascript/54-Spiral-Matrix.js rename to javascript/0054-spiral-matrix.js diff --git a/javascript/55-Jump-Game.js b/javascript/0055-jump-game.js similarity index 100% rename from javascript/55-Jump-Game.js rename to javascript/0055-jump-game.js diff --git a/javascript/56-Merge-Intervals.js b/javascript/0056-merge-intervals.js similarity index 100% rename from javascript/56-Merge-Intervals.js rename to javascript/0056-merge-intervals.js diff --git a/javascript/57-Insert-Interval.js b/javascript/0057-insert-interval.js similarity index 100% rename from javascript/57-Insert-Interval.js rename to javascript/0057-insert-interval.js diff --git a/javascript/58-Length-Of-Last-Word.js b/javascript/0058-length-of-last-word.js similarity index 100% rename from javascript/58-Length-Of-Last-Word.js rename to javascript/0058-length-of-last-word.js diff --git a/javascript/62-Unique-Paths.js b/javascript/0062-unique-paths.js similarity index 100% rename from javascript/62-Unique-Paths.js rename to javascript/0062-unique-paths.js diff --git a/javascript/66-plus-one.js b/javascript/0066-plus-one.js similarity index 100% rename from javascript/66-plus-one.js rename to javascript/0066-plus-one.js diff --git a/javascript/70-Climbing-Stairs.js b/javascript/0070-climbing-stairs.js similarity index 100% rename from javascript/70-Climbing-Stairs.js rename to javascript/0070-climbing-stairs.js diff --git a/javascript/72-Edit-Distance.js b/javascript/0072-edit-distance.js similarity index 100% rename from javascript/72-Edit-Distance.js rename to javascript/0072-edit-distance.js diff --git a/javascript/73-Set-Matrix-Zeroes.js b/javascript/0073-set-matrix-zeroes.js similarity index 100% rename from javascript/73-Set-Matrix-Zeroes.js rename to javascript/0073-set-matrix-zeroes.js diff --git a/javascript/74-Search-A-2D-Matrix.js b/javascript/0074-search-a-2d-matrix.js similarity index 100% rename from javascript/74-Search-A-2D-Matrix.js rename to javascript/0074-search-a-2d-matrix.js diff --git a/javascript/75-sort-colors.js b/javascript/0075-sort-colors.js similarity index 100% rename from javascript/75-sort-colors.js rename to javascript/0075-sort-colors.js diff --git a/javascript/76-Minimum-Window-Substring.js b/javascript/0076-minimum-window-substring.js similarity index 100% rename from javascript/76-Minimum-Window-Substring.js rename to javascript/0076-minimum-window-substring.js diff --git a/javascript/78-Subsets.js b/javascript/0078-subsets.js similarity index 100% rename from javascript/78-Subsets.js rename to javascript/0078-subsets.js diff --git a/javascript/79-Word-Search.js b/javascript/0079-word-search.js similarity index 100% rename from javascript/79-Word-Search.js rename to javascript/0079-word-search.js diff --git a/javascript/83-Remove-Duplicates-From-Sorted-List.js b/javascript/0083-remove-duplicates-from-sorted-list.js similarity index 100% rename from javascript/83-Remove-Duplicates-From-Sorted-List.js rename to javascript/0083-remove-duplicates-from-sorted-list.js diff --git a/javascript/84-Largest-Rectangle-in-Histogram.js b/javascript/0084-largest-rectangle-in-histogram.js similarity index 100% rename from javascript/84-Largest-Rectangle-in-Histogram.js rename to javascript/0084-largest-rectangle-in-histogram.js diff --git a/javascript/88-Merge-Sorted-Array.js b/javascript/0088-merge-sorted-array.js similarity index 100% rename from javascript/88-Merge-Sorted-Array.js rename to javascript/0088-merge-sorted-array.js diff --git a/javascript/90-Subsets-II.js b/javascript/0090-subsets-ii.js similarity index 100% rename from javascript/90-Subsets-II.js rename to javascript/0090-subsets-ii.js diff --git a/javascript/91-Decode-Ways.js b/javascript/0091-decode-ways.js similarity index 100% rename from javascript/91-Decode-Ways.js rename to javascript/0091-decode-ways.js diff --git a/javascript/92-Reverse-Linked-List-II.js b/javascript/0092-reverse-linked-list-ii.js similarity index 100% rename from javascript/92-Reverse-Linked-List-II.js rename to javascript/0092-reverse-linked-list-ii.js diff --git a/javascript/94-Binary-Tree-Inorder-Traversal.js b/javascript/0094-binary-tree-inorder-traversal.js similarity index 100% rename from javascript/94-Binary-Tree-Inorder-Traversal.js rename to javascript/0094-binary-tree-inorder-traversal.js diff --git a/javascript/97-Interleaving-String.js b/javascript/0097-interleaving-string.js similarity index 100% rename from javascript/97-Interleaving-String.js rename to javascript/0097-interleaving-string.js diff --git a/javascript/98-Validate-Binary-Search-Tree.js b/javascript/0098-validate-binary-search-tree.js similarity index 100% rename from javascript/98-Validate-Binary-Search-Tree.js rename to javascript/0098-validate-binary-search-tree.js diff --git a/javascript/100-Same-Tree.js b/javascript/0100-same-tree.js similarity index 100% rename from javascript/100-Same-Tree.js rename to javascript/0100-same-tree.js diff --git a/javascript/102-Binary-Tree-Level-Order-Traversal.js b/javascript/0102-binary-tree-level-order-traversal.js similarity index 100% rename from javascript/102-Binary-Tree-Level-Order-Traversal.js rename to javascript/0102-binary-tree-level-order-traversal.js diff --git a/javascript/104-Maximum-Depth-of-Binary-Tree.js b/javascript/0104-maximum-depth-of-binary-tree.js similarity index 100% rename from javascript/104-Maximum-Depth-of-Binary-Tree.js rename to javascript/0104-maximum-depth-of-binary-tree.js diff --git a/javascript/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.js b/javascript/0105-construct-binary-tree-from-preorder-and-inorder-traversal.js similarity index 100% rename from javascript/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.js rename to javascript/0105-construct-binary-tree-from-preorder-and-inorder-traversal.js diff --git a/javascript/108-Convert-Sorted-Array-to-Binary-Search-Tree.js b/javascript/0108-convert-sorted-array-to-binary-search-tree.js similarity index 100% rename from javascript/108-Convert-Sorted-Array-to-Binary-Search-Tree.js rename to javascript/0108-convert-sorted-array-to-binary-search-tree.js diff --git a/javascript/110-Balanced-Binary-Tree.js b/javascript/0110-balanced-binary-tree.js similarity index 100% rename from javascript/110-Balanced-Binary-Tree.js rename to javascript/0110-balanced-binary-tree.js diff --git a/javascript/112-Path-Sum.js b/javascript/0112-path-sum.js similarity index 100% rename from javascript/112-Path-Sum.js rename to javascript/0112-path-sum.js diff --git a/javascript/115-Distinct-Subsequences.js b/javascript/0115-distinct-subsequences.js similarity index 100% rename from javascript/115-Distinct-Subsequences.js rename to javascript/0115-distinct-subsequences.js diff --git a/javascript/118-Pascals-Triangle.js b/javascript/0118-pascals-triangle.js similarity index 100% rename from javascript/118-Pascals-Triangle.js rename to javascript/0118-pascals-triangle.js diff --git a/javascript/121-Best-Time-to-Buy-and-Sell-Stock.js b/javascript/0121-best-time-to-buy-and-sell-stock.js similarity index 100% rename from javascript/121-Best-Time-to-Buy-and-Sell-Stock.js rename to javascript/0121-best-time-to-buy-and-sell-stock.js diff --git a/javascript/122-best-time-to-buy-and-sell-stock-ii.js b/javascript/0122-best-time-to-buy-and-sell-stock-ii.js similarity index 100% rename from javascript/122-best-time-to-buy-and-sell-stock-ii.js rename to javascript/0122-best-time-to-buy-and-sell-stock-ii.js diff --git a/javascript/124-Binary-Tree-Maximum-Path-Sum.js b/javascript/0124-binary-tree-maximum-path-sum.js similarity index 100% rename from javascript/124-Binary-Tree-Maximum-Path-Sum.js rename to javascript/0124-binary-tree-maximum-path-sum.js diff --git a/javascript/125-Valid-Palindrome.js b/javascript/0125-valid-palindrome.js similarity index 100% rename from javascript/125-Valid-Palindrome.js rename to javascript/0125-valid-palindrome.js diff --git a/javascript/127-Word-Ladder.js b/javascript/0127-word-ladder.js similarity index 100% rename from javascript/127-Word-Ladder.js rename to javascript/0127-word-ladder.js diff --git a/javascript/128-Longest-consecutive-sequence.js b/javascript/0128-longest-consecutive-sequence.js similarity index 100% rename from javascript/128-Longest-consecutive-sequence.js rename to javascript/0128-longest-consecutive-sequence.js diff --git a/javascript/130-Surrounded-Regions.js b/javascript/0130-surrounded-regions.js similarity index 100% rename from javascript/130-Surrounded-Regions.js rename to javascript/0130-surrounded-regions.js diff --git a/javascript/131-Palindrome-Partitioning.js b/javascript/0131-palindrome-partitioning.js similarity index 100% rename from javascript/131-Palindrome-Partitioning.js rename to javascript/0131-palindrome-partitioning.js diff --git a/javascript/133-Clone-Graph.js b/javascript/0133-clone-graph.js similarity index 100% rename from javascript/133-Clone-Graph.js rename to javascript/0133-clone-graph.js diff --git a/javascript/134-Gas-Station.js b/javascript/0134-gas-station.js similarity index 100% rename from javascript/134-Gas-Station.js rename to javascript/0134-gas-station.js diff --git a/javascript/136-Single-Number.js b/javascript/0136-single-number.js similarity index 100% rename from javascript/136-Single-Number.js rename to javascript/0136-single-number.js diff --git a/javascript/138-Copy-List-with-Random-Pointer.js b/javascript/0138-copy-list-with-random-pointer.js similarity index 100% rename from javascript/138-Copy-List-with-Random-Pointer.js rename to javascript/0138-copy-list-with-random-pointer.js diff --git a/javascript/139-Word-Break.js b/javascript/0139-word-break.js similarity index 100% rename from javascript/139-Word-Break.js rename to javascript/0139-word-break.js diff --git a/javascript/141-Linked-List-Cycle.js b/javascript/0141-linked-list-cycle.js similarity index 100% rename from javascript/141-Linked-List-Cycle.js rename to javascript/0141-linked-list-cycle.js diff --git a/javascript/143-Reorder-List.js b/javascript/0143-reorder-list.js similarity index 100% rename from javascript/143-Reorder-List.js rename to javascript/0143-reorder-list.js diff --git a/javascript/146-LRU-Cache.js b/javascript/0146-lru-cache.js similarity index 100% rename from javascript/146-LRU-Cache.js rename to javascript/0146-lru-cache.js diff --git a/javascript/150-Evaluate-Reverse-Polish-Notation.js b/javascript/0150-evaluate-reverse-polish-notation.js similarity index 100% rename from javascript/150-Evaluate-Reverse-Polish-Notation.js rename to javascript/0150-evaluate-reverse-polish-notation.js diff --git a/javascript/152-Maximum-Product-Subarray.js b/javascript/0152-maximum-product-subarray.js similarity index 100% rename from javascript/152-Maximum-Product-Subarray.js rename to javascript/0152-maximum-product-subarray.js diff --git a/javascript/153-Find-Minimum-in-Rotated-Sorted-Array.js b/javascript/0153-find-minimum-in-rotated-sorted-array.js similarity index 100% rename from javascript/153-Find-Minimum-in-Rotated-Sorted-Array.js rename to javascript/0153-find-minimum-in-rotated-sorted-array.js diff --git a/javascript/155-Min-Stack.js b/javascript/0155-min-stack.js similarity index 100% rename from javascript/155-Min-Stack.js rename to javascript/0155-min-stack.js diff --git a/javascript/160-Intersection-of-Two-Linked-Lists.js b/javascript/0160-intersection-of-two-linked-lists.js similarity index 100% rename from javascript/160-Intersection-of-Two-Linked-Lists.js rename to javascript/0160-intersection-of-two-linked-lists.js diff --git a/javascript/167-Two-Sum-II.js b/javascript/0167-two-sum-ii-input-array-is-sorted.js similarity index 100% rename from javascript/167-Two-Sum-II.js rename to javascript/0167-two-sum-ii-input-array-is-sorted.js diff --git a/javascript/169-majority-element.js b/javascript/0169-majority-element.js similarity index 100% rename from javascript/169-majority-element.js rename to javascript/0169-majority-element.js diff --git a/javascript/173-Binary-Search-Tree-Iterator.js b/javascript/0173-binary-search-tree-iterator.js similarity index 100% rename from javascript/173-Binary-Search-Tree-Iterator.js rename to javascript/0173-binary-search-tree-iterator.js diff --git a/javascript/190-Reverse-Bits.js b/javascript/0190-reverse-bits.js similarity index 100% rename from javascript/190-Reverse-Bits.js rename to javascript/0190-reverse-bits.js diff --git a/javascript/191-Number-of-1-bits.js b/javascript/0191-number-of-1-bits.js similarity index 100% rename from javascript/191-Number-of-1-bits.js rename to javascript/0191-number-of-1-bits.js diff --git a/javascript/198-House-Robber.js b/javascript/0198-house-robber.js similarity index 100% rename from javascript/198-House-Robber.js rename to javascript/0198-house-robber.js diff --git a/javascript/199-binary-tree-right-side-view.js b/javascript/0199-binary-tree-right-side-view.js similarity index 100% rename from javascript/199-binary-tree-right-side-view.js rename to javascript/0199-binary-tree-right-side-view.js diff --git a/javascript/200-Number-of-Islands.js b/javascript/0200-number-of-islands.js similarity index 100% rename from javascript/200-Number-of-Islands.js rename to javascript/0200-number-of-islands.js diff --git a/javascript/202-Happy-Number.js b/javascript/0202-happy-number.js similarity index 100% rename from javascript/202-Happy-Number.js rename to javascript/0202-happy-number.js diff --git a/javascript/203-Remove-Linked-List-Elements.js b/javascript/0203-remove-linked-list-elements.js similarity index 100% rename from javascript/203-Remove-Linked-List-Elements.js rename to javascript/0203-remove-linked-list-elements.js diff --git a/javascript/205-Isomorphic-Strings.js b/javascript/0205-isomorphic-strings.js similarity index 100% rename from javascript/205-Isomorphic-Strings.js rename to javascript/0205-isomorphic-strings.js diff --git a/javascript/206-Reverse-Linked-List.js b/javascript/0206-reverse-linked-list.js similarity index 100% rename from javascript/206-Reverse-Linked-List.js rename to javascript/0206-reverse-linked-list.js diff --git a/javascript/207-Course-Schedule.js b/javascript/0207-course-schedule.js similarity index 100% rename from javascript/207-Course-Schedule.js rename to javascript/0207-course-schedule.js diff --git a/javascript/208-Implement-Trie.js b/javascript/0208-implement-trie-prefix-tree.js similarity index 100% rename from javascript/208-Implement-Trie.js rename to javascript/0208-implement-trie-prefix-tree.js diff --git a/javascript/210-Course-Schedule-II.js b/javascript/0210-course-schedule-ii.js similarity index 100% rename from javascript/210-Course-Schedule-II.js rename to javascript/0210-course-schedule-ii.js diff --git a/javascript/211-Design-Add-and-Search-Words-Data-Structure.js b/javascript/0211-design-add-and-search-words-data-structure.js similarity index 100% rename from javascript/211-Design-Add-and-Search-Words-Data-Structure.js rename to javascript/0211-design-add-and-search-words-data-structure.js diff --git a/javascript/212-Word-Search-ii.js b/javascript/0212-word-search-ii.js similarity index 100% rename from javascript/212-Word-Search-ii.js rename to javascript/0212-word-search-ii.js diff --git a/javascript/213-House-Robber-II.js b/javascript/0213-house-robber-ii.js similarity index 100% rename from javascript/213-House-Robber-II.js rename to javascript/0213-house-robber-ii.js diff --git a/javascript/215-Kth-Largest-Element-in-an-Array.js b/javascript/0215-kth-largest-element-in-an-array.js similarity index 100% rename from javascript/215-Kth-Largest-Element-in-an-Array.js rename to javascript/0215-kth-largest-element-in-an-array.js diff --git a/javascript/217-Contains-Duplicate.js b/javascript/0217-contains-duplicate.js similarity index 100% rename from javascript/217-Contains-Duplicate.js rename to javascript/0217-contains-duplicate.js diff --git a/javascript/226-Invert-Binary-Tree.js b/javascript/0226-invert-binary-tree.js similarity index 100% rename from javascript/226-Invert-Binary-Tree.js rename to javascript/0226-invert-binary-tree.js diff --git a/javascript/230-Kth-Smallest-Element-in-a-BST.js b/javascript/0230-kth-smallest-element-in-a-bst.js similarity index 100% rename from javascript/230-Kth-Smallest-Element-in-a-BST.js rename to javascript/0230-kth-smallest-element-in-a-bst.js diff --git a/javascript/234-Palindrome-Linked-List.js b/javascript/0234-palindrome-linked-list.js similarity index 100% rename from javascript/234-Palindrome-Linked-List.js rename to javascript/0234-palindrome-linked-list.js diff --git a/javascript/235-lowest-common-ancestor-of-a-binary-search-tree.js b/javascript/0235-lowest-common-ancestor-of-a-binary-search-tree.js similarity index 100% rename from javascript/235-lowest-common-ancestor-of-a-binary-search-tree.js rename to javascript/0235-lowest-common-ancestor-of-a-binary-search-tree.js diff --git a/javascript/238-Product-of-Array-Except-Self.js b/javascript/0238-product-of-array-except-self.js similarity index 100% rename from javascript/238-Product-of-Array-Except-Self.js rename to javascript/0238-product-of-array-except-self.js diff --git a/javascript/239-Sliding-Window-Maximum.js b/javascript/0239-sliding-window-maximum.js similarity index 100% rename from javascript/239-Sliding-Window-Maximum.js rename to javascript/0239-sliding-window-maximum.js diff --git a/javascript/242-Valid-Anagram.js b/javascript/0242-valid-anagram.js similarity index 100% rename from javascript/242-Valid-Anagram.js rename to javascript/0242-valid-anagram.js diff --git a/javascript/253-Meeting-Rooms-ii.js b/javascript/0253-meeting-rooms.js similarity index 100% rename from javascript/253-Meeting-Rooms-ii.js rename to javascript/0253-meeting-rooms.js diff --git a/javascript/261-Graph-Valid-Tree.js b/javascript/0261-graph-valid-tree.js similarity index 100% rename from javascript/261-Graph-Valid-Tree.js rename to javascript/0261-graph-valid-tree.js diff --git a/javascript/268-Missing-Number.js b/javascript/0268-missing-number.js similarity index 100% rename from javascript/268-Missing-Number.js rename to javascript/0268-missing-number.js diff --git a/javascript/269-Alien-Dictionary.js b/javascript/0269-alien-dictionary.js similarity index 100% rename from javascript/269-Alien-Dictionary.js rename to javascript/0269-alien-dictionary.js diff --git a/javascript/271-Encode-and-Decode-Strings.js b/javascript/0271-encode-and-decode-strings.js similarity index 100% rename from javascript/271-Encode-and-Decode-Strings.js rename to javascript/0271-encode-and-decode-strings.js diff --git a/javascript/283-Move-Zeroes.js b/javascript/0283-move-zeroes.js similarity index 100% rename from javascript/283-Move-Zeroes.js rename to javascript/0283-move-zeroes.js diff --git a/javascript/286-Walls-And-Gates.js b/javascript/0286-walls-and-gates.js similarity index 100% rename from javascript/286-Walls-And-Gates.js rename to javascript/0286-walls-and-gates.js diff --git a/javascript/287-Find-the-Duplicate-Number.js b/javascript/0287-find-the-duplicate-number.js similarity index 100% rename from javascript/287-Find-the-Duplicate-Number.js rename to javascript/0287-find-the-duplicate-number.js diff --git a/javascript/290-word-pattern.js b/javascript/0290-word-pattern.js similarity index 100% rename from javascript/290-word-pattern.js rename to javascript/0290-word-pattern.js diff --git a/javascript/295-Find-Median-from-Data-Stream.js b/javascript/0295-find-median-from-data-stream.js similarity index 100% rename from javascript/295-Find-Median-from-Data-Stream.js rename to javascript/0295-find-median-from-data-stream.js diff --git a/javascript/297-Serialize-And-Deserialize-Binary-Tree.js b/javascript/0297-serialize-and-deserialize-binary-tree.js similarity index 100% rename from javascript/297-Serialize-And-Deserialize-Binary-Tree.js rename to javascript/0297-serialize-and-deserialize-binary-tree.js diff --git a/javascript/300-Longest-Increasing-Subsequence.js b/javascript/0300-longest-increasing-subsequence.js similarity index 100% rename from javascript/300-Longest-Increasing-Subsequence.js rename to javascript/0300-longest-increasing-subsequence.js diff --git a/javascript/309-Best-Time-To-Buy-And-Sell-Stock-With-Cooldown.js b/javascript/0309-best-time-to-buy-and-sell-stock-with-cooldown.js similarity index 100% rename from javascript/309-Best-Time-To-Buy-And-Sell-Stock-With-Cooldown.js rename to javascript/0309-best-time-to-buy-and-sell-stock-with-cooldown.js diff --git a/javascript/312-Burst-Balloons.js b/javascript/0312-burst-balloons.js similarity index 100% rename from javascript/312-Burst-Balloons.js rename to javascript/0312-burst-balloons.js diff --git a/javascript/322-Coin-Change.js b/javascript/0322-coin-change.js similarity index 100% rename from javascript/322-Coin-Change.js rename to javascript/0322-coin-change.js diff --git a/javascript/323-countComponents.js b/javascript/0323-number-of-connected-components-in-an-undirected-graph.js similarity index 100% rename from javascript/323-countComponents.js rename to javascript/0323-number-of-connected-components-in-an-undirected-graph.js diff --git a/javascript/329-Longest-Increasing-Path-in-a-Matrix.js b/javascript/0329-longest-increasing-path-in-a-matrix.js similarity index 100% rename from javascript/329-Longest-Increasing-Path-in-a-Matrix.js rename to javascript/0329-longest-increasing-path-in-a-matrix.js diff --git a/javascript/332-Reconstruct-Itinerary.js b/javascript/0332-reconstruct-itinerary.js similarity index 100% rename from javascript/332-Reconstruct-Itinerary.js rename to javascript/0332-reconstruct-itinerary.js diff --git a/javascript/338-Counting-Bits.js b/javascript/0338-counting-bits.js similarity index 100% rename from javascript/338-Counting-Bits.js rename to javascript/0338-counting-bits.js diff --git a/javascript/344-Reverse-String.js b/javascript/0344-reverse-string.js similarity index 100% rename from javascript/344-Reverse-String.js rename to javascript/0344-reverse-string.js diff --git a/javascript/347-Top-K-Frequent-Elements.js b/javascript/0347-top-k-frequent-elements.js similarity index 100% rename from javascript/347-Top-K-Frequent-Elements.js rename to javascript/0347-top-k-frequent-elements.js diff --git a/javascript/355-Design-Twitter.js b/javascript/0355-design-twitter.js similarity index 100% rename from javascript/355-Design-Twitter.js rename to javascript/0355-design-twitter.js diff --git a/javascript/367-Valid-Perfect-Square.js b/javascript/0367-valid-perfect-square.js similarity index 100% rename from javascript/367-Valid-Perfect-Square.js rename to javascript/0367-valid-perfect-square.js diff --git a/javascript/371-Sum-of-Two-Integers.js b/javascript/0371-sum-of-two-integers.js similarity index 100% rename from javascript/371-Sum-of-Two-Integers.js rename to javascript/0371-sum-of-two-integers.js diff --git a/javascript/392-Is-Subsequence.js b/javascript/0392-is-subsequence.js similarity index 100% rename from javascript/392-Is-Subsequence.js rename to javascript/0392-is-subsequence.js diff --git a/javascript/416-Partition-Equal-Subset-Sum.js b/javascript/0416-partition-equal-subset-sum.js similarity index 100% rename from javascript/416-Partition-Equal-Subset-Sum.js rename to javascript/0416-partition-equal-subset-sum.js diff --git a/javascript/417-Pacific-Atlantic-Water-Flow.js b/javascript/0417-pacific-atlantic-water-flow.js similarity index 100% rename from javascript/417-Pacific-Atlantic-Water-Flow.js rename to javascript/0417-pacific-atlantic-water-flow.js diff --git a/javascript/424-Longest-Repeating-Character-Replacement.js b/javascript/0424-longest-repeating-character-replacement.js similarity index 100% rename from javascript/424-Longest-Repeating-Character-Replacement.js rename to javascript/0424-longest-repeating-character-replacement.js diff --git a/javascript/435-Non-overlapping-Intervals.js b/javascript/0435-non-overlapping-intervals.js similarity index 100% rename from javascript/435-Non-overlapping-Intervals.js rename to javascript/0435-non-overlapping-intervals.js diff --git a/javascript/448-find-all-numbers-disappeared-in-an-array.js b/javascript/0448-find-all-numbers-disappeared-in-an-array.js similarity index 100% rename from javascript/448-find-all-numbers-disappeared-in-an-array.js rename to javascript/0448-find-all-numbers-disappeared-in-an-array.js diff --git a/javascript/473-Matchsticks-To-Square.js b/javascript/0473-matchsticks-to-square.js similarity index 100% rename from javascript/473-Matchsticks-To-Square.js rename to javascript/0473-matchsticks-to-square.js diff --git a/javascript/494-Target-Sum.js b/javascript/0494-target-sum.js similarity index 100% rename from javascript/494-Target-Sum.js rename to javascript/0494-target-sum.js diff --git a/javascript/518-Coin-Change-2.js b/javascript/0518-coin-change-ii.js similarity index 100% rename from javascript/518-Coin-Change-2.js rename to javascript/0518-coin-change-ii.js diff --git a/javascript/535-encode-and-decode-tinyurl.js b/javascript/0535-encode-and-decode-tinyurl.js similarity index 100% rename from javascript/535-encode-and-decode-tinyurl.js rename to javascript/0535-encode-and-decode-tinyurl.js diff --git a/javascript/543-Diameter-Of-Binary-Tree.js b/javascript/0543-diameter-of-binary-tree.js similarity index 100% rename from javascript/543-Diameter-Of-Binary-Tree.js rename to javascript/0543-diameter-of-binary-tree.js diff --git a/javascript/554-brick-wall.js b/javascript/0554-brick-wall.js similarity index 100% rename from javascript/554-brick-wall.js rename to javascript/0554-brick-wall.js diff --git a/javascript/567-Permutation-In-String.js b/javascript/0567-permutation-in-string.js similarity index 100% rename from javascript/567-Permutation-In-String.js rename to javascript/0567-permutation-in-string.js diff --git a/javascript/572-Subtree-of-Another-Tree.js b/javascript/0572-subtree-of-another-tree.js similarity index 100% rename from javascript/572-Subtree-of-Another-Tree.js rename to javascript/0572-subtree-of-another-tree.js diff --git a/javascript/605-can-place-flowers.js b/javascript/0605-can-place-flowers.js similarity index 100% rename from javascript/605-can-place-flowers.js rename to javascript/0605-can-place-flowers.js diff --git a/javascript/617-Merge-Two-Binary-Trees.js b/javascript/0617-merge-two-binary-trees.js similarity index 100% rename from javascript/617-Merge-Two-Binary-Trees.js rename to javascript/0617-merge-two-binary-trees.js diff --git a/javascript/621-Task-Scheduler.js b/javascript/0621-task-scheduler.js similarity index 100% rename from javascript/621-Task-Scheduler.js rename to javascript/0621-task-scheduler.js diff --git a/javascript/647-Palindromic-Substrings.js b/javascript/0647-palindromic-substrings.js similarity index 100% rename from javascript/647-Palindromic-Substrings.js rename to javascript/0647-palindromic-substrings.js diff --git a/javascript/669-Trim-a-Binary-Search-Tree.js b/javascript/0669-trim-a-binary-search-tree.js similarity index 100% rename from javascript/669-Trim-a-Binary-Search-Tree.js rename to javascript/0669-trim-a-binary-search-tree.js diff --git a/javascript/678-Valid-Parenthesis-String.js b/javascript/0678-valid-parenthesis-string.js similarity index 100% rename from javascript/678-Valid-Parenthesis-String.js rename to javascript/0678-valid-parenthesis-string.js diff --git a/javascript/684-Redundant-Connection.js b/javascript/0684-redundant-connection.js similarity index 100% rename from javascript/684-Redundant-Connection.js rename to javascript/0684-redundant-connection.js diff --git a/javascript/695-Max-Area-Of-Island.js b/javascript/0695-max-area-of-island.js similarity index 100% rename from javascript/695-Max-Area-Of-Island.js rename to javascript/0695-max-area-of-island.js diff --git a/javascript/703-Kth-Largest-Element-In-A-Stream.js b/javascript/0703-kth-largest-element-in-a-stream.js similarity index 100% rename from javascript/703-Kth-Largest-Element-In-A-Stream.js rename to javascript/0703-kth-largest-element-in-a-stream.js diff --git a/javascript/704-Binary-Search.js b/javascript/0704-binary-search.js similarity index 100% rename from javascript/704-Binary-Search.js rename to javascript/0704-binary-search.js diff --git a/javascript/724-Find-Pivot-Index.js b/javascript/0724-find-pivot-index.js similarity index 100% rename from javascript/724-Find-Pivot-Index.js rename to javascript/0724-find-pivot-index.js diff --git a/javascript/739-daily-temperatures.js b/javascript/0739-daily-temperatures.js similarity index 100% rename from javascript/739-daily-temperatures.js rename to javascript/0739-daily-temperatures.js diff --git a/javascript/743-Network-Delay-Time.js b/javascript/0743-network-delay-time.js similarity index 100% rename from javascript/743-Network-Delay-Time.js rename to javascript/0743-network-delay-time.js diff --git a/javascript/746-Min-Cost-Climbing-Stairs.js b/javascript/0746-min-cost-climbing-stairs.js similarity index 100% rename from javascript/746-Min-Cost-Climbing-Stairs.js rename to javascript/0746-min-cost-climbing-stairs.js diff --git a/javascript/763-Partition-Labels.js b/javascript/0763-partition-labels.js similarity index 100% rename from javascript/763-Partition-Labels.js rename to javascript/0763-partition-labels.js diff --git a/javascript/778-Swim-in-Rising-Water.js b/javascript/0778-swim-in-rising-water.js similarity index 100% rename from javascript/778-Swim-in-Rising-Water.js rename to javascript/0778-swim-in-rising-water.js diff --git a/javascript/787-Cheapest-Flights-Within-K-Stops.js b/javascript/0787-cheapest-flights-within-k-stops.js similarity index 100% rename from javascript/787-Cheapest-Flights-Within-K-Stops.js rename to javascript/0787-cheapest-flights-within-k-stops.js diff --git a/javascript/846-Hand-of-Straights.js b/javascript/0846-hand-of-straights.js similarity index 100% rename from javascript/846-Hand-of-Straights.js rename to javascript/0846-hand-of-straights.js diff --git a/javascript/853-Car-Fleet.js b/javascript/0853-car-fleet.js similarity index 100% rename from javascript/853-Car-Fleet.js rename to javascript/0853-car-fleet.js diff --git a/javascript/875-Koko-Eating-Bananas.js b/javascript/0875-koko-eating-bananas.js similarity index 100% rename from javascript/875-Koko-Eating-Bananas.js rename to javascript/0875-koko-eating-bananas.js diff --git a/javascript/929-Unique-Email-Addresses.js b/javascript/0929-unique-email-addresses.js similarity index 100% rename from javascript/929-Unique-Email-Addresses.js rename to javascript/0929-unique-email-addresses.js diff --git a/javascript/973-K-Closest-Points-to-Origin.js b/javascript/0973-k-closest-points-to-origin.js similarity index 100% rename from javascript/973-K-Closest-Points-to-Origin.js rename to javascript/0973-k-closest-points-to-origin.js diff --git a/javascript/981-Time-Based-Key-Value-Store.js b/javascript/0981-time-based-key-value-store.js similarity index 100% rename from javascript/981-Time-Based-Key-Value-Store.js rename to javascript/0981-time-based-key-value-store.js diff --git a/javascript/994-Rotting-Oranges.js b/javascript/0994-rotting-oranges.js similarity index 100% rename from javascript/994-Rotting-Oranges.js rename to javascript/0994-rotting-oranges.js diff --git a/javascript/1046-last-stone-weight.js b/javascript/1046-last-stone-weight.js new file mode 100644 index 000000000..d19a8999e --- /dev/null +++ b/javascript/1046-last-stone-weight.js @@ -0,0 +1,33 @@ +/** + * https://leetcode.com/problems/last-stone-weight/ + * Time O(N * log(N)) | Space O(N) + * @param {number[]} stones + * @return {number} + */ +var lastStoneWeight = function (stones) { + const maxHeap = getMaxHeap(stones) + + shrink(maxHeap) + + return !maxHeap.isEmpty() + ? maxHeap.front().element + : 0 +}; + +const getMaxHeap = (stones, maxHeap = new MaxPriorityQueue()) => { + for (const stone of stones) { + maxHeap.enqueue(stone) + } + + return maxHeap +} + +const shrink = (maxHeap) => { + while (1 < maxHeap.size()) { + const [ x, y ] = [ maxHeap.dequeue().element, maxHeap.dequeue().element ] + const difference = x - y; + + const isPositive = 0 < difference + if (isPositive) maxHeap.enqueue(difference); + } +} \ No newline at end of file diff --git a/javascript/1143-longest-common-subsequence.js b/javascript/1143-longest-common-subsequence.js new file mode 100644 index 000000000..66ce896f3 --- /dev/null +++ b/javascript/1143-longest-common-subsequence.js @@ -0,0 +1,144 @@ +/** + * DP - Top Down + * Matrix - Memoization + * Time O(N * (M^2)) | Space O(N * M) + * https://leetcode.com/problems/longest-common-subsequence/ + * @param {string} text1 + * @param {string} text2 + * @return {number} + */ + var longestCommonSubsequence = (text1, text2, p1 = 0, p2 = 0, memo = initMemo(text1, text2)) => { + const isBaseCase = ((p1 === text1.length) || (p2 === text2.length)); + if (isBaseCase) return 0; + + const hasSeen = (memo[p1][p2] !== null); + if (hasSeen) return memo[p1][p2]; + + return dfs(text1, text2, p1, p2, memo);/* Time O((N * M) * M)) | Space O((N * M) + HEIGHT) */ +} + +var initMemo = (text1, text2) => new Array((text1.length + 1)).fill()/* Time O(N) | Space O(N) */ + .map(() => new Array((text2.length + 1)).fill(null)); /* Time O(M) | Space O(M) */ + +var dfs = (text1, text2, p1, p2, memo) => { + const left = longestCommonSubsequence(text1, text2, (p1 + 1), p2, memo); /* Time O(N * M) | Space O(HEIGHT) */ + + const index = text2.indexOf(text1[p1], p2); /* Time O(M) */ + const isPrefix = (index !== -1); + + const right = isPrefix + ? (longestCommonSubsequence(text1, text2, (p1 + 1), (index + 1), memo) + 1)/* Time O(N * M) | Space O(HEIGHT) */ + : 0; + + memo[p1][p2] = Math.max(left, right); /* | Space O(N * M) */ + return memo[p1][p2]; +} + +/** + * DP - Top Down + * Matrix - Memoization + * Time O(N * M) | Space O(N * M) + * https://leetcode.com/problems/longest-common-subsequence/ + * @param {string} text1 + * @param {string} text2 + * @return {number} + */ +var longestCommonSubsequence = (text1, text2, p1 = 0, p2 = 0, memo = initMemo(text1, text2)) => { + const isBaseCase = ((p1 === text1.length) || (p2 === text2.length)); + if (isBaseCase) return 0; + + const hasSeen = (memo[p1][p2] !== null); + if (hasSeen) return memo[p1][p2]; + + return dfs(text1, text2, p1, p2, memo);/* Time O(N * M) | Space O((N * M) + HEIGHT) */ +} + +var initMemo = (text1, text2) => new Array((text1.length + 1)).fill()/* Time O(N) | Space O(N) */ + .map(() => new Array((text2.length + 1)).fill(null)); /* Time O(M) | Space O(M) */ + +var dfs = (text1, text2, p1, p2, memo) => { + const left = (longestCommonSubsequence(text1, text2, (p1 + 1), (p2 + 1), memo) + 1);/* Time O(N * M) | Space O(HEIGHT) */ + const right = /* Time O(N * M) | Space O(HEIGHT) */ + Math.max(longestCommonSubsequence(text1, text2, p1, (p2 + 1), memo), longestCommonSubsequence(text1, text2, (p1 + 1), p2, memo)); + + const isEqual = (text1[p1] == text2[p2]); + const count = isEqual + ? left + : right + + memo[p1][p2] = count; /* | Space O(N * M) */ + return memo[p1][p2]; +} + +/** + * DP - Bottom Up + * Matrix - Tabulation + * Time O(N * M) | Space O(N * M) + * https://leetcode.com/problems/longest-common-subsequence/ + * @param {string} text1 + * @param {string} text2 + * @return {number} + */ +var longestCommonSubsequence = (text1, text2) => { + const tabu = initTabu(text1, text2);/* Time O(N * M) | Space O(N * M) */ + + search(text1, text2, tabu); /* Time O(N * M) | Space O(N * M) */ + + return tabu[0][0]; +}; + +var initTabu = (text1, text2) => + new Array((text1.length + 1)).fill() /* Time O(N) | Space O(N) */ + .map(() => new Array((text2.length + 1)).fill(0));/* Time O(M) | Space O(M) */ + +var search = (text1, text2, tabu) => { + const [ n, m ] = [ text1.length, text2.length ]; + + for (let x = (n - 1); (0 <= x); x--) {/* Time O(N) */ + for (let y = (m - 1); (0 <= y); y--) {/* Time O(M) */ + tabu[x][y] = (text1[x] === text2[y]) /* Space O(N * M) */ + ? (tabu[x + 1][y + 1] + 1) + : Math.max(tabu[x + 1][y], tabu[x][y + 1]); + } + } +} + +/** + * DP - Bottom Up + * Matrix - Tabulation + * Time O(N * M) | Space O(M) + * https://leetcode.com/problems/longest-common-subsequence/ + * @param {string} text1 + * @param {string} text2 + * @return {number} + */ +var longestCommonSubsequence = (text1, text2) => { + const canSwap = (text2.length < text1.length); + if (canSwap) [ text1, text2 ] = [ text2, text1 ]; + + let tabu = initTabu(text1); /* Time O(M) | Space O(M) */ + + tabu = search(text1, text2, tabu);/* Time O(N * M) | Space O(M) */ + + return tabu[0]; +}; + +var initTabu = (text1) => new Array((text1.length + 1)).fill(0) + +var search = (text1, text2, tabu) => { + for (let col = (text2.length - 1); (0 <= col); col--) {/* Time O(N) */ + const temp = initTabu(text1); /* Space O(M) */ + + for (let row = (text1.length - 1); (0 <= row); row--) {/* Time O(M) */ + const isEqual = (text1[row] == text2[col]); + + temp[row] = isEqual /* Space O(M) */ + ? (tabu[(row + 1)] + 1) + : Math.max(tabu[row], temp[(row + 1)]); + } + + tabu = temp; /* Space O(M) */ + } + + return tabu; +} diff --git a/javascript/1209-remove-all-adjacent-duplicates-in-string-ii.js b/javascript/1209-remove-all-adjacent-duplicates-in-string-ii.js new file mode 100644 index 000000000..00d0cefb7 --- /dev/null +++ b/javascript/1209-remove-all-adjacent-duplicates-in-string-ii.js @@ -0,0 +1,22 @@ +/** + * @param {string} s + * @param {number} k + * @return {string} + */ +var removeDuplicates = function (s, k) { + const stack = []; // [char, count]; + + for (const c of s) { + if (stack.length !== 0 && stack[stack.length - 1][0] === c) { + stack[stack.length - 1][1]++; + } else { + stack.push([c, 1]); + } + + if (stack[stack.length - 1][1] === k) { + stack.pop(); + } + } + + return stack.reduce((res, el) => (res += el[0].repeat(el[1])), ''); +}; diff --git a/javascript/1299-replace-elements-with-greatest-element-on-right-side.js b/javascript/1299-replace-elements-with-greatest-element-on-right-side.js new file mode 100644 index 000000000..f2283a7e4 --- /dev/null +++ b/javascript/1299-replace-elements-with-greatest-element-on-right-side.js @@ -0,0 +1,56 @@ +/** + * Reverse - Space O(1) + * Time O(N) | Space O(N) + * https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/ + * @param {number[]} arr + * @return {number[]} + */ +var replaceElements = (arr, max = -1, ans = [ -1 ]) => { + arr = arr.reverse(); /* Time O(N) */ + + for (let i = 0; (i < (arr.length - 1)); i++) {/* Time O(N) */ + max = Math.max(max, arr[i]); + ans[(i + 1)] = max; /* Space O(N) */ + } + + return ans.reverse(); /* Time O(N) */ +}; + +/** + * Backward - In-Place + * Time O(N) | Space O(1) + * https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/ + * @param {number[]} arr + * @return {number[]} + */ +var replaceElements = (arr, max = -1) => { + for (let i = (arr.length - 1); (0 <= i); i--) {/* Time O(N) */ + const num = arr[i]; + + arr[i] = max; + max = Math.max(max, num); + } + + return arr; +}; +// This is brute force with O(n^2). Just for reference's sake. +// submission link: https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/submissions/844439163/ +var replaceElementsBrute = function(arr) { + + for(let i = 0; i < arr.length; i++) { + arr[i] = biggestElement(i, arr); + } + + arr[arr.length - 1] = -1; + return arr; +}; + +function biggestElement(index, arr) { + + let biggest = 0; + for(let i = index + 1; i < arr.length; i++) { + biggest = Math.max(biggest, arr[i]); + } + + return biggest; +} diff --git a/javascript/1448-count-good-nodes-in-binary-tree.js b/javascript/1448-count-good-nodes-in-binary-tree.js new file mode 100644 index 000000000..21cfd6d56 --- /dev/null +++ b/javascript/1448-count-good-nodes-in-binary-tree.js @@ -0,0 +1,59 @@ +/** + * https://leetcode.com/problems/count-good-nodes-in-binary-tree/ + * Time O(N) | Space O(H) + * @param {TreeNode} root + * @return {number} + */ + var goodNodes = function(root, max = -Infinity, total = [ 0 ]) { + count(root, max, total); + + return total[0] +}; + +const count = (root, max, total) => { + const isBaseCase = root === null; + if (isBaseCase) return 0; + + return dfs(root, max, total); +} + +const dfs = (root, max, total) => { + const isGood = max <= root.val + if (isGood) total[0]++; + + max = Math.max(max, root.val); + + count(root.left, max, total); + count(root.right, max, total); +} + +/** + * https://leetcode.com/problems/count-good-nodes-in-binary-tree/ + * Time O(N) | Space O(W) + * @param {TreeNode} root + * @return {number} + */ +var goodNodes = function(root, ) { + const isBaseCase = root === null; + if (isBaseCase) return 0 + + return bfs([[ root, -Infinity ]]); +} + +const bfs = (queue, total = 0) => { + while (queue.length) { + for (let i = (queue.length - 1); 0 <= i; i--) { + let [ root, max ] = queue.shift(); + + const isGood = max <= root.val; + if (isGood) total++; + + max = Math.max(max, root.val); + + if (root.right) queue.push([ root.right, max ]); + if (root.left) queue.push([ root.left, max ]); + } + } + + return total; +} diff --git a/javascript/1584-min-cost-to-connect-all-points.js b/javascript/1584-min-cost-to-connect-all-points.js new file mode 100644 index 000000000..b5d3a295a --- /dev/null +++ b/javascript/1584-min-cost-to-connect-all-points.js @@ -0,0 +1,70 @@ +/** + * Prim's algorithm + * https://leetcode.com/problems/min-cost-to-connect-all-points/solution/ + * @param {number[][]} points + * @return {number} + */ +const minCostConnectPoints = (points) => { + const isBaseCase = ((points.length === 0) || (1000 <= points.length)); + if (isBaseCase) return 0; + + const { graph, seen, minHeap } = buildGraph(points); + + return search(points, graph, seen, minHeap); +}; + +const initGraph = (points) => ({ + graph: new Array(points.length).fill().map(() => []), + seen: new Array(points.length).fill(false), + minHeap: new MinPriorityQueue() +}) + +const buildGraph = (points) => { + const { graph, seen, minHeap } = initGraph(points); + + for (let src = 0; src < (points.length - 1); src++) { + for (let dst = (src + 1); (dst < points.length); dst++) { + const cost = getCost(points, src, dst); + + graph[src].push([ dst, cost ]); + graph[dst].push([ src, cost ]); + } + } + + const [ src, cost, priority ] = [ 0, 0, 0 ]; + const node = [ src, cost ]; + + minHeap.enqueue(node, priority); + + return { graph, seen, minHeap }; +} + +const getCost = (points, src, dst) => { + const [ [ x1, y1 ], [ x2, y2 ] ] = [ points[src], points[dst] ]; + + return (Math.abs(x1 - x2) + Math.abs(y1 - y2)); +} + +const search = (points, graph, seen, minHeap, nodeCount = 0, cost = 0) => { + while (nodeCount < points.length) { + let [ src, srcCost ] = minHeap.dequeue().element; + + if (seen[src]) continue; + seen[src] = true; + + cost += srcCost; + nodeCount += 1; + + checkNeighbors(graph, src, seen, minHeap); + } + + return cost; +} + +const checkNeighbors = (graph, src, seen, minHeap) => { + for (const [ dst, dstCost ] of graph[src]) { + if (seen[dst]) continue; + + minHeap.enqueue([ dst, dstCost ], dstCost); + } +} \ No newline at end of file diff --git a/javascript/1984-minimum-difference-between-highest-and-lowest-of-k-scores.js b/javascript/1984-minimum-difference-between-highest-and-lowest-of-k-scores.js new file mode 100644 index 000000000..b50b93538 --- /dev/null +++ b/javascript/1984-minimum-difference-between-highest-and-lowest-of-k-scores.js @@ -0,0 +1,30 @@ +/** + * Loglinear/N*log(N) + * Time O(N*log(N)) | Space O(1) + * https://leetcode.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores + * + * @param {number[]} nums + * @param {number} k + * @return {number} + */ +var minimumDifference = function(nums, k) { + + const isEdgeCase = (k === 1); + if (isEdgeCase) return 0; + + nums = nums.sort((a, b) => { + return a - b; + }); + + let i = 0; + let j = k - 1; + let minDiffrence = Infinity; + + while (j < nums.length) { + minDiffrence = Math.min(Math.abs(nums[i] - nums[j]), minDiffrence); + j++; + i++; + } + + return minDiffrence; +}; diff --git a/javascript/2001-Number-of-Pairs -of-Interchangeable-Rectangles.js b/javascript/2001-number-of-pairs-of-interchangeable-rectangles.js similarity index 100% rename from javascript/2001-Number-of-Pairs -of-Interchangeable-Rectangles.js rename to javascript/2001-number-of-pairs-of-interchangeable-rectangles.js diff --git a/javascript/2013-detect-squares.js b/javascript/2013-detect-squares.js new file mode 100644 index 000000000..ed26ae11a --- /dev/null +++ b/javascript/2013-detect-squares.js @@ -0,0 +1,52 @@ +/* + * Time O(N) | Space O(N) + * https://leetcode.com/problems/detect-squares + */ +class DetectSquares { + constructor () { + this.map = {}; /* Space O(N) */ + this.points = [];/* Space O(N) */ + } + + add (point, { map, points } = this) { + const [ x, y ] = point; + const key = this.getKey(x, y); + const value = ((map[key] || 0) + 1); + + map[key] = value; /* Space O(N) */ + points.push(point);/* Space O(N) */ + } + + count (point, { points } = this, score = 0) { + const [ x1, y1 ] = point; + + for (const [ x2, y2 ] of points) {/* Time O(N) */ + const isSame = (Math.abs(x2 - x1) === Math.abs(y2 - y1)); + const isEqual = ((x1 === x2) || (y1 === y2)); + const canSkip = (!isSame || isEqual); + if (canSkip) continue; + + score += this.getScore(x1, y1, x2, y2); + } + + return score; + }; + + getKey (x, y) { + return `${x},${y}`; + } + + getScore (x1, y1, x2, y2, { map } = this) { + const [ aKey, bKey ] = [ this.getKey(x1, y2), this.getKey(x2, y1) ]; + const [ aScore, bScore ] = [ (map[aKey] || 0), (map[bKey] || 0) ]; + + return (aScore * bScore); + } +}; + +/** + * Your DetectSquares object will be instantiated and called as such: + * var obj = new DetectSquares() + * obj.add(point) + * var param_2 = obj.count(point) + */ \ No newline at end of file diff --git a/javascript/297-Serialize-and-Deserialize-Binary-Tree.js b/javascript/297-Serialize-and-Deserialize-Binary-Tree.js deleted file mode 100644 index 96c3341de..000000000 --- a/javascript/297-Serialize-and-Deserialize-Binary-Tree.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Encodes a tree to a single string. - * https://leetcode.com/problems/serialize-and-deserialize-binary-tree/solution/ - * Time O(N) | Space O(H) - * @param {TreeNode} root - * @return {string} - */ - var serialize = function(root, result = []) { - serial(root, result); - - return result; -}; - -const serial = (root, result) => { - const isBase = root === null; - if (isBase) return result.push(null); - - dfsSerialize(root, result); -} - -const dfsSerialize = (node, result) => { - result.push(node.val); - serial(node.left, result); - serial(node.right, result); -}; - -/** - * Encodes a tree to a single string. - * https://leetcode.com/problems/serialize-and-deserialize-binary-tree/solution/ - * Time O(N) | Space O(H) - * @param {TreeNode} root - * @return {string} - */ -var serialize = function(root) { - const isBaseCase = root === null; - if (isBaseCase) return [ null ]; - - return dfsSerializeIterative([ root ]); -}; - -const dfsSerializeIterative = (stack, result = []) => { - while (stack.length) { - const curr = stack.pop(); - - const isNull = curr === null; - if (isNull) { - result.push(null); - continue; - } - - result.push(curr.val); - stack.push(curr.right); - stack.push(curr.left); - } - - return result; -} - -/** -* Decodes your encoded data to tree. -* https://leetcode.com/problems/serialize-and-deserialize-binary-tree/solution/ -* Time O(N) | Space O(H) -* @param {string} data -* @return {TreeNode} -*/ -var deserialize = function(data) { - const isBaseCase = !data.length; - if (isBaseCase) return null; - - const val = data.shift(); - - const isNull = val === null; - if (isNull) return null; - - return dfsDeserialize(val, data) -}; - -const dfsDeserialize = (val, data) => { - const node = new TreeNode(val); - - node.left = deserialize(data); - node.right = deserialize(data); - - return node; -} diff --git a/kotlin/1-Two-Sum.kt b/kotlin/0001-two-sum.kt similarity index 100% rename from kotlin/1-Two-Sum.kt rename to kotlin/0001-two-sum.kt diff --git a/kotlin/2-Add-Two-Numbers.kt b/kotlin/0002-add-two-numbers.kt similarity index 100% rename from kotlin/2-Add-Two-Numbers.kt rename to kotlin/0002-add-two-numbers.kt diff --git a/kotlin/3-Longest-Substring-Without-Repeating-Characters.kt b/kotlin/0003-longest-substring-without-repeating-characters.kt similarity index 100% rename from kotlin/3-Longest-Substring-Without-Repeating-Characters.kt rename to kotlin/0003-longest-substring-without-repeating-characters.kt diff --git a/kotlin/4-Median-Of-Two-Sorted-Arrays.kt b/kotlin/0004-median-of-two-sorted-arrays.kt similarity index 100% rename from kotlin/4-Median-Of-Two-Sorted-Arrays.kt rename to kotlin/0004-median-of-two-sorted-arrays.kt diff --git a/kotlin/7-Reverse-Integer.kt b/kotlin/0007-reverse-integer.kt similarity index 100% rename from kotlin/7-Reverse-Integer.kt rename to kotlin/0007-reverse-integer.kt diff --git a/kotlin/11-Container-With-Most-Water.kt b/kotlin/0011-container-with-most-water.kt similarity index 100% rename from kotlin/11-Container-With-Most-Water.kt rename to kotlin/0011-container-with-most-water.kt diff --git a/kotlin/15-3Sum.kt b/kotlin/0015-3sum.kt similarity index 100% rename from kotlin/15-3Sum.kt rename to kotlin/0015-3sum.kt diff --git a/kotlin/19-Remove-Nth-Node-From-End-of-List.kt b/kotlin/0019-remove-nth-node-from-end-of-list.kt similarity index 100% rename from kotlin/19-Remove-Nth-Node-From-End-of-List.kt rename to kotlin/0019-remove-nth-node-from-end-of-list.kt diff --git a/kotlin/20-Valid-Parentheses.kt b/kotlin/0020-valid-parentheses.kt similarity index 100% rename from kotlin/20-Valid-Parentheses.kt rename to kotlin/0020-valid-parentheses.kt diff --git a/kotlin/21-Merge-Two-Sorted-Lists.kt b/kotlin/0021-merge-two-sorted-lists.kt similarity index 100% rename from kotlin/21-Merge-Two-Sorted-Lists.kt rename to kotlin/0021-merge-two-sorted-lists.kt diff --git a/kotlin/22-Generate-Parentheses.kt b/kotlin/0022-generate-parentheses.kt similarity index 100% rename from kotlin/22-Generate-Parentheses.kt rename to kotlin/0022-generate-parentheses.kt diff --git a/kotlin/23-Merge-K-Sorted-Lists.kt b/kotlin/0023-merge-k-sorted-lists.kt similarity index 100% rename from kotlin/23-Merge-K-Sorted-Lists.kt rename to kotlin/0023-merge-k-sorted-lists.kt diff --git a/kotlin/25-Reverse-Nodes-In-K-Group.kt b/kotlin/0025-reverse-nodes-in-k-group.kt similarity index 100% rename from kotlin/25-Reverse-Nodes-In-K-Group.kt rename to kotlin/0025-reverse-nodes-in-k-group.kt diff --git a/kotlin/33-Search-In-Rotated-Sorted-Array.kt b/kotlin/0033-search-in-rotated-sorted-array.kt similarity index 100% rename from kotlin/33-Search-In-Rotated-Sorted-Array.kt rename to kotlin/0033-search-in-rotated-sorted-array.kt diff --git a/kotlin/36-Valid-Sudoku.kt b/kotlin/0036-valid-sudoku.kt similarity index 100% rename from kotlin/36-Valid-Sudoku.kt rename to kotlin/0036-valid-sudoku.kt diff --git a/kotlin/39-Combination-Sum.kt b/kotlin/0039-combination-sum.kt similarity index 100% rename from kotlin/39-Combination-Sum.kt rename to kotlin/0039-combination-sum.kt diff --git a/kotlin/40-Combination-Sum.kt b/kotlin/0040-combination-sum-ii.kt similarity index 100% rename from kotlin/40-Combination-Sum.kt rename to kotlin/0040-combination-sum-ii.kt diff --git a/kotlin/42-Trapping-Rain-Water.kt b/kotlin/0042-trapping-rain-water.kt similarity index 100% rename from kotlin/42-Trapping-Rain-Water.kt rename to kotlin/0042-trapping-rain-water.kt diff --git a/kotlin/45-Jump-Game-II.kt b/kotlin/0045-jump-game-ii.kt similarity index 100% rename from kotlin/45-Jump-Game-II.kt rename to kotlin/0045-jump-game-ii.kt diff --git a/kotlin/46-Permutations.kt b/kotlin/0046-permutations.kt similarity index 100% rename from kotlin/46-Permutations.kt rename to kotlin/0046-permutations.kt diff --git a/kotlin/49-Group-Anagrams.kt b/kotlin/0049-group-anagrams.kt similarity index 100% rename from kotlin/49-Group-Anagrams.kt rename to kotlin/0049-group-anagrams.kt diff --git a/kotlin/53-Maximum-Subarray.kt b/kotlin/0053-maximum-subarray.kt similarity index 100% rename from kotlin/53-Maximum-Subarray.kt rename to kotlin/0053-maximum-subarray.kt diff --git a/kotlin/54-Spiral-Matrix.kt b/kotlin/0054-spiral-matrix.kt similarity index 100% rename from kotlin/54-Spiral-Matrix.kt rename to kotlin/0054-spiral-matrix.kt diff --git a/kotlin/55-Jump-Game.kt b/kotlin/0055-jump-game.kt similarity index 100% rename from kotlin/55-Jump-Game.kt rename to kotlin/0055-jump-game.kt diff --git a/kotlin/56-Merge-Intervals.kt b/kotlin/0056-merge-intervals.kt similarity index 100% rename from kotlin/56-Merge-Intervals.kt rename to kotlin/0056-merge-intervals.kt diff --git a/kotlin/62-Unique-Paths.kt b/kotlin/0062-unique-paths.kt similarity index 100% rename from kotlin/62-Unique-Paths.kt rename to kotlin/0062-unique-paths.kt diff --git a/kotlin/66-Plus-One.kt b/kotlin/0066-plus-one.kt similarity index 100% rename from kotlin/66-Plus-One.kt rename to kotlin/0066-plus-one.kt diff --git a/kotlin/70-Climbing-Stairs.kt b/kotlin/0070-climbing-stairs.kt similarity index 100% rename from kotlin/70-Climbing-Stairs.kt rename to kotlin/0070-climbing-stairs.kt diff --git a/kotlin/73-Set-Matrix-Zeros.kt b/kotlin/0073-set-matrix-zeroes.kt similarity index 100% rename from kotlin/73-Set-Matrix-Zeros.kt rename to kotlin/0073-set-matrix-zeroes.kt diff --git a/kotlin/74-Search-A-2D-Matrix.kt b/kotlin/0074-search-a-2d-matrix.kt similarity index 100% rename from kotlin/74-Search-A-2D-Matrix.kt rename to kotlin/0074-search-a-2d-matrix.kt diff --git a/kotlin/75-Sort-Colors.kt b/kotlin/0075-sort-colors.kt similarity index 100% rename from kotlin/75-Sort-Colors.kt rename to kotlin/0075-sort-colors.kt diff --git a/kotlin/76-Minimum-Window-Substring.kt b/kotlin/0076-minimum-window-substring.kt similarity index 100% rename from kotlin/76-Minimum-Window-Substring.kt rename to kotlin/0076-minimum-window-substring.kt diff --git a/kotlin/78-Subsets.kt b/kotlin/0078-subsets.kt similarity index 100% rename from kotlin/78-Subsets.kt rename to kotlin/0078-subsets.kt diff --git a/kotlin/79-Word-Search.kt b/kotlin/0079-word-search.kt similarity index 100% rename from kotlin/79-Word-Search.kt rename to kotlin/0079-word-search.kt diff --git a/kotlin/84-Largest-Rectangle-In-Histogram.kt b/kotlin/0084-largest-rectangle-in-histogram.kt similarity index 100% rename from kotlin/84-Largest-Rectangle-In-Histogram.kt rename to kotlin/0084-largest-rectangle-in-histogram.kt diff --git a/kotlin/90-Subsets-II.kt b/kotlin/0090-subsets-ii.kt similarity index 100% rename from kotlin/90-Subsets-II.kt rename to kotlin/0090-subsets-ii.kt diff --git a/kotlin/91-Decode-Ways.kt b/kotlin/0091-decode-ways.kt similarity index 100% rename from kotlin/91-Decode-Ways.kt rename to kotlin/0091-decode-ways.kt diff --git a/kotlin/98-Validate-Binary-Search-Tree.kt b/kotlin/0098-validate-binary-search-tree.kt similarity index 100% rename from kotlin/98-Validate-Binary-Search-Tree.kt rename to kotlin/0098-validate-binary-search-tree.kt diff --git a/kotlin/100-Same-Tree.kt b/kotlin/0100-same-tree.kt similarity index 100% rename from kotlin/100-Same-Tree.kt rename to kotlin/0100-same-tree.kt diff --git a/kotlin/102-Binary-Tree-Level-Order-Traversal.kt b/kotlin/0102-binary-tree-level-order-traversal.kt similarity index 100% rename from kotlin/102-Binary-Tree-Level-Order-Traversal.kt rename to kotlin/0102-binary-tree-level-order-traversal.kt diff --git a/kotlin/104-Maximum-Depth-Of-Binary-Tree.kt b/kotlin/0104-maximum-depth-of-binary-tree.kt similarity index 100% rename from kotlin/104-Maximum-Depth-Of-Binary-Tree.kt rename to kotlin/0104-maximum-depth-of-binary-tree.kt diff --git a/kotlin/105-Construct-Binary-Tree-From-Preorder-And-Inorder-Traversal.kt b/kotlin/0105-construct-binary-tree-from-preorder-and-inorder-traversal.kt similarity index 100% rename from kotlin/105-Construct-Binary-Tree-From-Preorder-And-Inorder-Traversal.kt rename to kotlin/0105-construct-binary-tree-from-preorder-and-inorder-traversal.kt diff --git a/kotlin/110-Balanced-Binary-Tree.kt b/kotlin/0110-balanced-binary-tree.kt similarity index 100% rename from kotlin/110-Balanced-Binary-Tree.kt rename to kotlin/0110-balanced-binary-tree.kt diff --git a/kotlin/121-Best-Time-to-Buy-and-Sell-Stocks.kt b/kotlin/0121-best-time-to-buy-and-sell-stock.kt similarity index 100% rename from kotlin/121-Best-Time-to-Buy-and-Sell-Stocks.kt rename to kotlin/0121-best-time-to-buy-and-sell-stock.kt diff --git a/kotlin/124-Binary-Tree-Maximumu-Path-Sum.kt b/kotlin/0124-binary-tree-maximum-path-sum.kt similarity index 100% rename from kotlin/124-Binary-Tree-Maximumu-Path-Sum.kt rename to kotlin/0124-binary-tree-maximum-path-sum.kt diff --git a/kotlin/125-Valid-Palindrome.kt b/kotlin/0125-valid-palindrome.kt similarity index 100% rename from kotlin/125-Valid-Palindrome.kt rename to kotlin/0125-valid-palindrome.kt diff --git a/kotlin/127-Word-Ladder.kt b/kotlin/0127-word-ladder.kt similarity index 100% rename from kotlin/127-Word-Ladder.kt rename to kotlin/0127-word-ladder.kt diff --git a/kotlin/128-Longest-Consecutive-Sequence.kt b/kotlin/0128-longest-consecutive-sequence.kt similarity index 100% rename from kotlin/128-Longest-Consecutive-Sequence.kt rename to kotlin/0128-longest-consecutive-sequence.kt diff --git a/kotlin/130-Surrounded-Regions.kt b/kotlin/0130-surrounded-regions.kt similarity index 100% rename from kotlin/130-Surrounded-Regions.kt rename to kotlin/0130-surrounded-regions.kt diff --git a/kotlin/134-Gas-Station.kt b/kotlin/0134-gas-station.kt similarity index 100% rename from kotlin/134-Gas-Station.kt rename to kotlin/0134-gas-station.kt diff --git a/kotlin/136-Single-Number.kt b/kotlin/0136-single-number.kt similarity index 100% rename from kotlin/136-Single-Number.kt rename to kotlin/0136-single-number.kt diff --git a/kotlin/138-Copy-List-With-Random-Pointer.kt b/kotlin/0138-copy-list-with-random-pointer.kt similarity index 100% rename from kotlin/138-Copy-List-With-Random-Pointer.kt rename to kotlin/0138-copy-list-with-random-pointer.kt diff --git a/kotlin/141-Linked-List-Cycle.kt b/kotlin/0141-linked-list-cycle.kt similarity index 100% rename from kotlin/141-Linked-List-Cycle.kt rename to kotlin/0141-linked-list-cycle.kt diff --git a/kotlin/143-Reorder-List.kt b/kotlin/0143-reorder-list.kt similarity index 100% rename from kotlin/143-Reorder-List.kt rename to kotlin/0143-reorder-list.kt diff --git a/kotlin/146-LRU-Cache.kt b/kotlin/0146-lru-cache.kt similarity index 100% rename from kotlin/146-LRU-Cache.kt rename to kotlin/0146-lru-cache.kt diff --git a/kotlin/150-Evaluate-Reverse-Polish-Notation.kt b/kotlin/0150-evaluate-reverse-polish-notation.kt similarity index 100% rename from kotlin/150-Evaluate-Reverse-Polish-Notation.kt rename to kotlin/0150-evaluate-reverse-polish-notation.kt diff --git a/kotlin/152-Maximum-Product-Subarray.kt b/kotlin/0152-maximum-product-subarray.kt similarity index 100% rename from kotlin/152-Maximum-Product-Subarray.kt rename to kotlin/0152-maximum-product-subarray.kt diff --git a/kotlin/153-Find-Minimum-In-Rotated-Sorted-Array.kt b/kotlin/0153-find-minimum-in-rotated-sorted-array.kt similarity index 100% rename from kotlin/153-Find-Minimum-In-Rotated-Sorted-Array.kt rename to kotlin/0153-find-minimum-in-rotated-sorted-array.kt diff --git a/kotlin/155-Min-Stack.kt b/kotlin/0155-min-stack.kt similarity index 100% rename from kotlin/155-Min-Stack.kt rename to kotlin/0155-min-stack.kt diff --git a/kotlin/167-Two-Sum-2.kt b/kotlin/0167-two-sum-ii-input-array-is-sorted.kt similarity index 100% rename from kotlin/167-Two-Sum-2.kt rename to kotlin/0167-two-sum-ii-input-array-is-sorted.kt diff --git a/kotlin/190-Reverse-Bits.kt b/kotlin/0190-reverse-bits.kt similarity index 100% rename from kotlin/190-Reverse-Bits.kt rename to kotlin/0190-reverse-bits.kt diff --git a/kotlin/191-Number-Of-1-Bits.kt b/kotlin/0191-number-of-1-bits.kt similarity index 100% rename from kotlin/191-Number-Of-1-Bits.kt rename to kotlin/0191-number-of-1-bits.kt diff --git a/kotlin/198-House-Robber.kt b/kotlin/0198-house-robber.kt similarity index 100% rename from kotlin/198-House-Robber.kt rename to kotlin/0198-house-robber.kt diff --git a/kotlin/199-Binary-Tree-Right-Side-View.kt b/kotlin/0199-binary-tree-right-side-view.kt similarity index 100% rename from kotlin/199-Binary-Tree-Right-Side-View.kt rename to kotlin/0199-binary-tree-right-side-view.kt diff --git a/kotlin/200-Number-Of-Islands.kt b/kotlin/0200-number-of-islands.kt similarity index 100% rename from kotlin/200-Number-Of-Islands.kt rename to kotlin/0200-number-of-islands.kt diff --git a/kotlin/202-Happy-Number.kt b/kotlin/0202-happy-number.kt similarity index 100% rename from kotlin/202-Happy-Number.kt rename to kotlin/0202-happy-number.kt diff --git a/kotlin/206-Reverse-Linked-List.kt b/kotlin/0206-reverse-linked-list.kt similarity index 100% rename from kotlin/206-Reverse-Linked-List.kt rename to kotlin/0206-reverse-linked-list.kt diff --git a/kotlin/207-Course-Schedule.kt b/kotlin/0207-course-schedule.kt similarity index 100% rename from kotlin/207-Course-Schedule.kt rename to kotlin/0207-course-schedule.kt diff --git a/kotlin/208-Implement-Trie.kt b/kotlin/0208-implement-trie-prefix-tree.kt similarity index 100% rename from kotlin/208-Implement-Trie.kt rename to kotlin/0208-implement-trie-prefix-tree.kt diff --git a/kotlin/211-Design-Add-And-Search-Words-Data-Structure.kt b/kotlin/0211-design-add-and-search-words-data-structure.kt similarity index 100% rename from kotlin/211-Design-Add-And-Search-Words-Data-Structure.kt rename to kotlin/0211-design-add-and-search-words-data-structure.kt diff --git a/kotlin/212-Word-Search-II.kt b/kotlin/0212-word-search-ii.kt similarity index 100% rename from kotlin/212-Word-Search-II.kt rename to kotlin/0212-word-search-ii.kt diff --git a/kotlin/213-House-Robber-II.kt b/kotlin/0213-house-robber-ii.kt similarity index 100% rename from kotlin/213-House-Robber-II.kt rename to kotlin/0213-house-robber-ii.kt diff --git a/kotlin/215-Kth-Largest-Element-In-Array.kt b/kotlin/0215-kth-largest-element-in-an-array.kt similarity index 100% rename from kotlin/215-Kth-Largest-Element-In-Array.kt rename to kotlin/0215-kth-largest-element-in-an-array.kt diff --git a/kotlin/217-Contains-Duplicate.kt b/kotlin/0217-contains-duplicate.kt similarity index 100% rename from kotlin/217-Contains-Duplicate.kt rename to kotlin/0217-contains-duplicate.kt diff --git a/kotlin/226-Invert-Binary-Tree.kt b/kotlin/0226-invert-binary-tree.kt similarity index 100% rename from kotlin/226-Invert-Binary-Tree.kt rename to kotlin/0226-invert-binary-tree.kt diff --git a/kotlin/230-Kth-Smallest-Element-In-A-BST.kt b/kotlin/0230-kth-smallest-element-in-a-bst.kt similarity index 100% rename from kotlin/230-Kth-Smallest-Element-In-A-BST.kt rename to kotlin/0230-kth-smallest-element-in-a-bst.kt diff --git a/kotlin/235-Lowest-Common-Ancestor-Of-Binary-Search-Tree.kt b/kotlin/0235-lowest-common-ancestor-of-a-binary-search-tree.kt similarity index 100% rename from kotlin/235-Lowest-Common-Ancestor-Of-Binary-Search-Tree.kt rename to kotlin/0235-lowest-common-ancestor-of-a-binary-search-tree.kt diff --git a/kotlin/238-Product-Of-Array-Except-Self.kt b/kotlin/0238-product-of-array-except-self.kt similarity index 100% rename from kotlin/238-Product-Of-Array-Except-Self.kt rename to kotlin/0238-product-of-array-except-self.kt diff --git a/kotlin/239-Sliding-Window-Maximum.kt b/kotlin/0239-sliding-window-maximum.kt similarity index 100% rename from kotlin/239-Sliding-Window-Maximum.kt rename to kotlin/0239-sliding-window-maximum.kt diff --git a/kotlin/242-Valid-Anagram.kt b/kotlin/0242-valid-anagram.kt similarity index 100% rename from kotlin/242-Valid-Anagram.kt rename to kotlin/0242-valid-anagram.kt diff --git a/kotlin/268-Missing-Number.kt b/kotlin/0268-missing-number.kt similarity index 100% rename from kotlin/268-Missing-Number.kt rename to kotlin/0268-missing-number.kt diff --git a/kotlin/287-Find-The-Duplicate-Number.kt b/kotlin/0287-find-the-duplicate-number.kt similarity index 100% rename from kotlin/287-Find-The-Duplicate-Number.kt rename to kotlin/0287-find-the-duplicate-number.kt diff --git a/kotlin/295-Find-Median-From-Data-Stream.kt b/kotlin/0295-find-median-from-data-stream.kt similarity index 100% rename from kotlin/295-Find-Median-From-Data-Stream.kt rename to kotlin/0295-find-median-from-data-stream.kt diff --git a/kotlin/297-Serialize-And-Deserialize-Binary-Tree.kt b/kotlin/0297-serialize-and-deserialize-binary-tree.kt similarity index 100% rename from kotlin/297-Serialize-And-Deserialize-Binary-Tree.kt rename to kotlin/0297-serialize-and-deserialize-binary-tree.kt diff --git a/kotlin/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.kt b/kotlin/0309-best-time-to-buy-and-sell-stock-with-cooldown.kt similarity index 100% rename from kotlin/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.kt rename to kotlin/0309-best-time-to-buy-and-sell-stock-with-cooldown.kt diff --git a/kotlin/322-Coin-Change.kt b/kotlin/0322-coin-change.kt similarity index 100% rename from kotlin/322-Coin-Change.kt rename to kotlin/0322-coin-change.kt diff --git a/kotlin/329-Longest-Increasing-Path-In-A-Matrix.kt b/kotlin/0329-longest-increasing-path-in-a-matrix.kt similarity index 100% rename from kotlin/329-Longest-Increasing-Path-In-A-Matrix.kt rename to kotlin/0329-longest-increasing-path-in-a-matrix.kt diff --git a/kotlin/332-Reconstruct-Itinerary.kt b/kotlin/0332-reconstruct-itinerary.kt similarity index 100% rename from kotlin/332-Reconstruct-Itinerary.kt rename to kotlin/0332-reconstruct-itinerary.kt diff --git a/kotlin/338-Counting-Bits.kt b/kotlin/0338-counting-bits.kt similarity index 100% rename from kotlin/338-Counting-Bits.kt rename to kotlin/0338-counting-bits.kt diff --git a/kotlin/347-Top-K-Frequent-Elements.kt b/kotlin/0347-top-k-frequent-elements.kt similarity index 100% rename from kotlin/347-Top-K-Frequent-Elements.kt rename to kotlin/0347-top-k-frequent-elements.kt diff --git a/kotlin/371-Sum-Of-Two-Integers.kt b/kotlin/0371-sum-of-two-integers.kt similarity index 100% rename from kotlin/371-Sum-Of-Two-Integers.kt rename to kotlin/0371-sum-of-two-integers.kt diff --git a/kotlin/417-Pacific-Atlantic-Waterflow.kt b/kotlin/0417-pacific-atlantic-water-flow.kt similarity index 100% rename from kotlin/417-Pacific-Atlantic-Waterflow.kt rename to kotlin/0417-pacific-atlantic-water-flow.kt diff --git a/kotlin/424-Longest-Repeating-Character-Replacement.kt b/kotlin/0424-longest-repeating-character-replacement.kt similarity index 100% rename from kotlin/424-Longest-Repeating-Character-Replacement.kt rename to kotlin/0424-longest-repeating-character-replacement.kt diff --git a/kotlin/543-Diameter-of-Binary-Tree.kt b/kotlin/0543-diameter-of-binary-tree.kt similarity index 100% rename from kotlin/543-Diameter-of-Binary-Tree.kt rename to kotlin/0543-diameter-of-binary-tree.kt diff --git a/kotlin/567-Permutation-In-String.kt b/kotlin/0567-permutation-in-string.kt similarity index 100% rename from kotlin/567-Permutation-In-String.kt rename to kotlin/0567-permutation-in-string.kt diff --git a/kotlin/572-Subtree-Of-Another-Tree.kt b/kotlin/0572-subtree-of-another-tree.kt similarity index 100% rename from kotlin/572-Subtree-Of-Another-Tree.kt rename to kotlin/0572-subtree-of-another-tree.kt diff --git a/kotlin/684-Redundant-Connection.kt b/kotlin/0684-redundant-connection.kt similarity index 100% rename from kotlin/684-Redundant-Connection.kt rename to kotlin/0684-redundant-connection.kt diff --git a/kotlin/695-Max-Area-Of-Island.kt b/kotlin/0695-max-area-of-island.kt similarity index 100% rename from kotlin/695-Max-Area-Of-Island.kt rename to kotlin/0695-max-area-of-island.kt diff --git a/kotlin/704-Binary-Search.kt b/kotlin/0704-binary-search.kt similarity index 100% rename from kotlin/704-Binary-Search.kt rename to kotlin/0704-binary-search.kt diff --git a/kotlin/739-Daily-Temperatures.kt b/kotlin/0739-daily-temperatures.kt similarity index 100% rename from kotlin/739-Daily-Temperatures.kt rename to kotlin/0739-daily-temperatures.kt diff --git a/kotlin/746-Min-Cost-Climbing-Stairs.kt b/kotlin/0746-min-cost-climbing-stairs.kt similarity index 100% rename from kotlin/746-Min-Cost-Climbing-Stairs.kt rename to kotlin/0746-min-cost-climbing-stairs.kt diff --git a/kotlin/787-Cheapest-Flights-Within-K-Stops.kt b/kotlin/0787-cheapest-flights-within-k-stops.kt similarity index 100% rename from kotlin/787-Cheapest-Flights-Within-K-Stops.kt rename to kotlin/0787-cheapest-flights-within-k-stops.kt diff --git a/kotlin/853-Car-Fleet.kt b/kotlin/0853-car-fleet.kt similarity index 100% rename from kotlin/853-Car-Fleet.kt rename to kotlin/0853-car-fleet.kt diff --git a/kotlin/875-Koko-Eating-Bananas.kt b/kotlin/0875-koko-eating-bananas.kt similarity index 100% rename from kotlin/875-Koko-Eating-Bananas.kt rename to kotlin/0875-koko-eating-bananas.kt diff --git a/kotlin/973-K-Closest-Points-To-Origin.kt b/kotlin/0973-k-closest-points-to-origin.kt similarity index 100% rename from kotlin/973-K-Closest-Points-To-Origin.kt rename to kotlin/0973-k-closest-points-to-origin.kt diff --git a/kotlin/981-Time-Based-Key-Value-Store.kt b/kotlin/0981-time-based-key-value-store.kt similarity index 100% rename from kotlin/981-Time-Based-Key-Value-Store.kt rename to kotlin/0981-time-based-key-value-store.kt diff --git a/kotlin/994-Rotting-Oranges.kt b/kotlin/0994-rotting-oranges.kt similarity index 100% rename from kotlin/994-Rotting-Oranges.kt rename to kotlin/0994-rotting-oranges.kt diff --git a/kotlin/1046-last-stone-weight.kt b/kotlin/1046-last-stone-weight.kt new file mode 100644 index 000000000..232e3a004 --- /dev/null +++ b/kotlin/1046-last-stone-weight.kt @@ -0,0 +1,23 @@ +class Solution { + fun lastStoneWeight(stones: IntArray): Int { + val heap = PriorityQueue{a, b -> b-a} + + stones.forEach{ stone -> + heap.add(stone) + } + + while (!heap.isEmpty()) { + if (heap.size == 1) + return heap.poll() + + val first = heap.poll() + val sec = heap.poll() + + if (first != sec) { + heap.add(first - sec) + } + } + + return 0 + } +} \ No newline at end of file diff --git a/kotlin/1143-longest-common-subsequence.kt b/kotlin/1143-longest-common-subsequence.kt new file mode 100644 index 000000000..ea744645e --- /dev/null +++ b/kotlin/1143-longest-common-subsequence.kt @@ -0,0 +1,23 @@ +class Solution { + fun longestCommonSubsequence(text1: String, text2: String): Int { + if (text1.isEmpty() || text2.isEmpty()) { + return 0 + } + + val M = text1.length + val N = text2.length + + val dp = Array(M + 1){IntArray(N + 1){0}} + + for (i in 1..M) { + for (j in 1..N) { + if (text1[i - 1] == text2[j - 1]) { + dp[i][j] = dp[i - 1][j - 1] + 1 + } else { + dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]) + } + } + } + return dp[M][N] + } +} \ No newline at end of file diff --git a/kotlin/1448-count-good-nodes-in-binary-tree.kt b/kotlin/1448-count-good-nodes-in-binary-tree.kt new file mode 100644 index 000000000..c3c3f8971 --- /dev/null +++ b/kotlin/1448-count-good-nodes-in-binary-tree.kt @@ -0,0 +1,29 @@ +/** + * Example: + * var ti = TreeNode(5) + * var v = ti.`val` + * Definition for a binary tree node. + * class TreeNode(var `val`: Int) { + * var left: TreeNode? = null + * var right: TreeNode? = null + * } + */ +class Solution { + fun goodNodes(root: TreeNode?): Int { + return goodNodes(root, root!!.`val`) + } + + fun goodNodes(node: TreeNode?, parent: Int): Int { + if (node == null) + return 0; + + val res = if (parent > node.`val`) 0 else 1; + + val max = Math.max(parent, node.`val`); + + val left = goodNodes(node.left, max); + val right = goodNodes(node.right, max); + + return res + left + right; + } +} \ No newline at end of file diff --git a/python/1-Two-Sum.py b/python/0001-two-sum.py similarity index 100% rename from python/1-Two-Sum.py rename to python/0001-two-sum.py diff --git a/python/2-Add-Two-Numbers.py b/python/0002-add-two-numbers.py similarity index 100% rename from python/2-Add-Two-Numbers.py rename to python/0002-add-two-numbers.py diff --git a/python/3-Longest-Substring-Without-Repeating-Characters.py b/python/0003-longest-substring-without-repeating-characters.py similarity index 100% rename from python/3-Longest-Substring-Without-Repeating-Characters.py rename to python/0003-longest-substring-without-repeating-characters.py diff --git a/python/4-median-of-two-sorted-arrays.py b/python/0004-median-of-two-sorted-arrays.py similarity index 100% rename from python/4-median-of-two-sorted-arrays.py rename to python/0004-median-of-two-sorted-arrays.py diff --git a/python/5-Longest-Palindromic-Substring.py b/python/0005-longest-palindromic-substring.py similarity index 100% rename from python/5-Longest-Palindromic-Substring.py rename to python/0005-longest-palindromic-substring.py diff --git a/python/7-Reverse-Integer.py b/python/0007-reverse-integer.py similarity index 100% rename from python/7-Reverse-Integer.py rename to python/0007-reverse-integer.py diff --git a/python/10-Regular-Expression-Matching.py b/python/0010-regular-expression-matching.py similarity index 100% rename from python/10-Regular-Expression-Matching.py rename to python/0010-regular-expression-matching.py diff --git a/python/11-Container-With-Most-Water.py b/python/0011-container-with-most-water.py similarity index 100% rename from python/11-Container-With-Most-Water.py rename to python/0011-container-with-most-water.py diff --git a/python/12-Integer-To-Roman.py b/python/0012-integer-to-roman.py similarity index 100% rename from python/12-Integer-To-Roman.py rename to python/0012-integer-to-roman.py diff --git a/python/13-Roman-To-Integer.py b/python/0013-roman-to-integer.py similarity index 100% rename from python/13-Roman-To-Integer.py rename to python/0013-roman-to-integer.py diff --git a/python/14-Longest-Common-Prefix.py b/python/0014-longest-common-prefix.py similarity index 100% rename from python/14-Longest-Common-Prefix.py rename to python/0014-longest-common-prefix.py diff --git a/python/15-3Sum.py b/python/0015-3sum.py similarity index 100% rename from python/15-3Sum.py rename to python/0015-3sum.py diff --git a/python/17-Letter-Combinations-of-a-Phone-Number.py b/python/0017-letter-combinations-of-a-phone-number.py similarity index 100% rename from python/17-Letter-Combinations-of-a-Phone-Number.py rename to python/0017-letter-combinations-of-a-phone-number.py diff --git a/python/18-4Sum.py b/python/0018-4sum.py similarity index 100% rename from python/18-4Sum.py rename to python/0018-4sum.py diff --git a/python/19-Remove-Nth-node-from-end-of-List.py b/python/0019-remove-nth-node-from-end-of-list.py similarity index 100% rename from python/19-Remove-Nth-node-from-end-of-List.py rename to python/0019-remove-nth-node-from-end-of-list.py diff --git a/python/20-Valid-Parentheses.py b/python/0020-valid-parentheses.py similarity index 100% rename from python/20-Valid-Parentheses.py rename to python/0020-valid-parentheses.py diff --git a/python/21-Merge-Two-Sorted-Lists.py b/python/0021-merge-two-sorted-lists.py similarity index 100% rename from python/21-Merge-Two-Sorted-Lists.py rename to python/0021-merge-two-sorted-lists.py diff --git a/python/22-Generate-Parentheses.py b/python/0022-generate-parentheses.py similarity index 100% rename from python/22-Generate-Parentheses.py rename to python/0022-generate-parentheses.py diff --git a/python/23-Merge-K-Sorted-Lists.py b/python/0023-merge-k-sorted-lists.py similarity index 100% rename from python/23-Merge-K-Sorted-Lists.py rename to python/0023-merge-k-sorted-lists.py diff --git a/python/24-Swap-Nodes-in-Pairs.py b/python/0024-swap-nodes-in-pairs.py similarity index 100% rename from python/24-Swap-Nodes-in-Pairs.py rename to python/0024-swap-nodes-in-pairs.py diff --git a/python/25-Reverse-Nodes-in-K-Group.py b/python/0025-reverse-nodes-in-k-group.py similarity index 100% rename from python/25-Reverse-Nodes-in-K-Group.py rename to python/0025-reverse-nodes-in-k-group.py diff --git a/python/26-Remove-Duplicates-from-Sorted Array.py b/python/0026-remove-duplicates-from-sorted-array.py similarity index 100% rename from python/26-Remove-Duplicates-from-Sorted Array.py rename to python/0026-remove-duplicates-from-sorted-array.py diff --git a/python/27-Remove-Element.py b/python/0027-remove-element.py similarity index 100% rename from python/27-Remove-Element.py rename to python/0027-remove-element.py diff --git a/python/28-Implement-strStr.py b/python/0028-find-the-index-of-the-first-occurrence-in-a-string.py similarity index 100% rename from python/28-Implement-strStr.py rename to python/0028-find-the-index-of-the-first-occurrence-in-a-string.py diff --git a/python/33-Search-In-Rotated-Sorted-Array.py b/python/0033-search-in-rotated-sorted-array.py similarity index 100% rename from python/33-Search-In-Rotated-Sorted-Array.py rename to python/0033-search-in-rotated-sorted-array.py diff --git a/python/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py b/python/0034-find-first-and-last-position-of-element-in-sorted-array.py similarity index 100% rename from python/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py rename to python/0034-find-first-and-last-position-of-element-in-sorted-array.py diff --git a/python/35-Search-Insert-Position.py b/python/0035-search-insert-position.py similarity index 100% rename from python/35-Search-Insert-Position.py rename to python/0035-search-insert-position.py diff --git a/python/36-Valid-Sudoku.py b/python/0036-valid-sudoku.py similarity index 100% rename from python/36-Valid-Sudoku.py rename to python/0036-valid-sudoku.py diff --git a/python/39-Combination-Sum.py b/python/0039-combination-sum.py similarity index 100% rename from python/39-Combination-Sum.py rename to python/0039-combination-sum.py diff --git a/python/40-Combination-Sum-II.py b/python/0040-combination-sum-ii.py similarity index 100% rename from python/40-Combination-Sum-II.py rename to python/0040-combination-sum-ii.py diff --git a/python/41-First-Missing-Positive.py b/python/0041-first-missing-positive.py similarity index 100% rename from python/41-First-Missing-Positive.py rename to python/0041-first-missing-positive.py diff --git a/python/42-Trapping-Rain-Water.py b/python/0042-trapping-rain-water.py similarity index 100% rename from python/42-Trapping-Rain-Water.py rename to python/0042-trapping-rain-water.py diff --git a/python/43-Multiply-Strings.py b/python/0043-multiply-strings.py similarity index 100% rename from python/43-Multiply-Strings.py rename to python/0043-multiply-strings.py diff --git a/python/45-Jump-Game-II.py b/python/0045-jump-game-ii.py similarity index 100% rename from python/45-Jump-Game-II.py rename to python/0045-jump-game-ii.py diff --git a/python/46-Permutations.py b/python/0046-permutations.py similarity index 100% rename from python/46-Permutations.py rename to python/0046-permutations.py diff --git a/python/48-Rotate-Image.py b/python/0048-rotate-image.py similarity index 100% rename from python/48-Rotate-Image.py rename to python/0048-rotate-image.py diff --git a/python/49-Group-Anagrams.py b/python/0049-group-anagrams.py similarity index 100% rename from python/49-Group-Anagrams.py rename to python/0049-group-anagrams.py diff --git a/python/50-Pow(x, n).py b/python/0050-powx-n.py similarity index 100% rename from python/50-Pow(x, n).py rename to python/0050-powx-n.py diff --git a/python/51-N-Queens.py b/python/0051-n-queens.py similarity index 100% rename from python/51-N-Queens.py rename to python/0051-n-queens.py diff --git a/python/53-Maximum-Subarray.py b/python/0053-maximum-subarray.py similarity index 100% rename from python/53-Maximum-Subarray.py rename to python/0053-maximum-subarray.py diff --git a/python/54-Spiral-Matrix.py b/python/0054-spiral-matrix.py similarity index 100% rename from python/54-Spiral-Matrix.py rename to python/0054-spiral-matrix.py diff --git a/python/55-Jump-Game.py b/python/0055-jump-game.py similarity index 100% rename from python/55-Jump-Game.py rename to python/0055-jump-game.py diff --git a/python/56-Merge-Intervals.py b/python/0056-merge-intervals.py similarity index 100% rename from python/56-Merge-Intervals.py rename to python/0056-merge-intervals.py diff --git a/python/57-Insert-Interval.py b/python/0057-insert-interval.py similarity index 100% rename from python/57-Insert-Interval.py rename to python/0057-insert-interval.py diff --git a/python/58-Length-Of-Last-Word.py b/python/0058-length-of-last-word.py similarity index 100% rename from python/58-Length-Of-Last-Word.py rename to python/0058-length-of-last-word.py diff --git a/python/62-Unique-Paths.py b/python/0062-unique-paths.py similarity index 100% rename from python/62-Unique-Paths.py rename to python/0062-unique-paths.py diff --git a/python/64-Minimum-Path-Sum.py b/python/0064-minimum-path-sum.py similarity index 100% rename from python/64-Minimum-Path-Sum.py rename to python/0064-minimum-path-sum.py diff --git a/python/66-Plus-One.py b/python/0066-plus-one.py similarity index 100% rename from python/66-Plus-One.py rename to python/0066-plus-one.py diff --git a/python/70-Climbing-Stairs.py b/python/0070-climbing-stairs.py similarity index 100% rename from python/70-Climbing-Stairs.py rename to python/0070-climbing-stairs.py diff --git a/python/71-Simplify-Path.py b/python/0071-simplify-path.py similarity index 100% rename from python/71-Simplify-Path.py rename to python/0071-simplify-path.py diff --git a/python/72-Edit-Distance.py b/python/0072-edit-distance.py similarity index 100% rename from python/72-Edit-Distance.py rename to python/0072-edit-distance.py diff --git a/python/73-Set-Matrix-Zeroes.py b/python/0073-set-matrix-zeroes.py similarity index 100% rename from python/73-Set-Matrix-Zeroes.py rename to python/0073-set-matrix-zeroes.py diff --git a/python/74-Search-a-2D-Matrix.py b/python/0074-search-a-2d-matrix.py similarity index 100% rename from python/74-Search-a-2D-Matrix.py rename to python/0074-search-a-2d-matrix.py diff --git a/python/76-Minimum-Window-Substring.py b/python/0076-minimum-window-substring.py similarity index 100% rename from python/76-Minimum-Window-Substring.py rename to python/0076-minimum-window-substring.py diff --git a/python/77-Combinations.py b/python/0077-combinations.py similarity index 100% rename from python/77-Combinations.py rename to python/0077-combinations.py diff --git a/python/78-Subsets.py b/python/0078-subsets.py similarity index 100% rename from python/78-Subsets.py rename to python/0078-subsets.py diff --git a/python/79-Word-Search.py b/python/0079-word-search.py similarity index 100% rename from python/79-Word-Search.py rename to python/0079-word-search.py diff --git a/python/83-Remove-Duplicates-From-Sorted-List.py b/python/0083-remove-duplicates-from-sorted-list.py similarity index 100% rename from python/83-Remove-Duplicates-From-Sorted-List.py rename to python/0083-remove-duplicates-from-sorted-list.py diff --git a/python/84-Largest-Rectangle-in-Histogram.py b/python/0084-largest-rectangle-in-histogram.py similarity index 100% rename from python/84-Largest-Rectangle-in-Histogram.py rename to python/0084-largest-rectangle-in-histogram.py diff --git a/python/90-Subsets-II.py b/python/0090-subsets-ii.py similarity index 100% rename from python/90-Subsets-II.py rename to python/0090-subsets-ii.py diff --git a/python/91-Decode-ways.py b/python/0091-decode-ways.py similarity index 100% rename from python/91-Decode-ways.py rename to python/0091-decode-ways.py diff --git a/python/92-Reverse-Linked-List-II.py b/python/0092-reverse-linked-list-ii.py similarity index 100% rename from python/92-Reverse-Linked-List-II.py rename to python/0092-reverse-linked-list-ii.py diff --git a/python/94-Binary-Tree-Inorder-Traversal.py b/python/0094-binary-tree-inorder-traversal.py similarity index 100% rename from python/94-Binary-Tree-Inorder-Traversal.py rename to python/0094-binary-tree-inorder-traversal.py diff --git a/python/97-Interleaving-Strings.py b/python/0097-interleaving-string.py similarity index 100% rename from python/97-Interleaving-Strings.py rename to python/0097-interleaving-string.py diff --git a/python/98-Validate-Binary-Search-Tree.py b/python/0098-validate-binary-search-tree.py similarity index 100% rename from python/98-Validate-Binary-Search-Tree.py rename to python/0098-validate-binary-search-tree.py diff --git a/python/100-Same-Tree.py b/python/0100-same-tree.py similarity index 100% rename from python/100-Same-Tree.py rename to python/0100-same-tree.py diff --git a/python/102-Binary-Tree-Level-Order-Traversal.py b/python/0102-binary-tree-level-order-traversal.py similarity index 100% rename from python/102-Binary-Tree-Level-Order-Traversal.py rename to python/0102-binary-tree-level-order-traversal.py diff --git a/python/104-Maximum-Depth-of-Binary-Tree.py b/python/0104-maximum-depth-of-binary-tree.py similarity index 100% rename from python/104-Maximum-Depth-of-Binary-Tree.py rename to python/0104-maximum-depth-of-binary-tree.py diff --git a/python/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py b/python/0105-construct-binary-tree-from-preorder-and-inorder-traversal.py similarity index 100% rename from python/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py rename to python/0105-construct-binary-tree-from-preorder-and-inorder-traversal.py diff --git a/python/110-Balanced-Binary-Tree.py b/python/0110-balanced-binary-tree.py similarity index 100% rename from python/110-Balanced-Binary-Tree.py rename to python/0110-balanced-binary-tree.py diff --git a/python/115-Distinct-Subsequences.py b/python/0115-distinct-subsequences.py similarity index 100% rename from python/115-Distinct-Subsequences.py rename to python/0115-distinct-subsequences.py diff --git a/python/118-Pascal-Triangle.py b/python/0118-pascals-triangle.py similarity index 100% rename from python/118-Pascal-Triangle.py rename to python/0118-pascals-triangle.py diff --git a/python/120-Triangle.py b/python/0120-triangle.py similarity index 100% rename from python/120-Triangle.py rename to python/0120-triangle.py diff --git a/python/121-Best-Time-To-Buy-and-Sell-Stock.py b/python/0121-best-time-to-buy-and-sell-stock.py similarity index 100% rename from python/121-Best-Time-To-Buy-and-Sell-Stock.py rename to python/0121-best-time-to-buy-and-sell-stock.py diff --git a/python/124-Binary-Tree-Maximum-Path-Sum.py b/python/0124-binary-tree-maximum-path-sum.py similarity index 100% rename from python/124-Binary-Tree-Maximum-Path-Sum.py rename to python/0124-binary-tree-maximum-path-sum.py diff --git a/python/125-Valid-Palindrome.py b/python/0125-valid-palindrome.py similarity index 100% rename from python/125-Valid-Palindrome.py rename to python/0125-valid-palindrome.py diff --git a/python/127-Word-Ladder.py b/python/0127-word-ladder.py similarity index 100% rename from python/127-Word-Ladder.py rename to python/0127-word-ladder.py diff --git a/python/128-Longest-consecutive-sequence.py b/python/0128-longest-consecutive-sequence.py similarity index 100% rename from python/128-Longest-consecutive-sequence.py rename to python/0128-longest-consecutive-sequence.py diff --git a/python/130-Surrounded-Regions.py b/python/0130-surrounded-regions.py similarity index 100% rename from python/130-Surrounded-Regions.py rename to python/0130-surrounded-regions.py diff --git a/python/131-Palindrome-Partitioning.py b/python/0131-palindrome-partitioning.py similarity index 100% rename from python/131-Palindrome-Partitioning.py rename to python/0131-palindrome-partitioning.py diff --git a/python/133-Clone-Graph.py b/python/0133-clone-graph.py similarity index 100% rename from python/133-Clone-Graph.py rename to python/0133-clone-graph.py diff --git a/python/134-Gas-Station.py b/python/0134-gas-station.py similarity index 100% rename from python/134-Gas-Station.py rename to python/0134-gas-station.py diff --git a/python/136-Single-Number.py b/python/0136-single-number.py similarity index 100% rename from python/136-Single-Number.py rename to python/0136-single-number.py diff --git a/python/138-Copy-List-With-Random-Pointer.py b/python/0138-copy-list-with-random-pointer.py similarity index 100% rename from python/138-Copy-List-With-Random-Pointer.py rename to python/0138-copy-list-with-random-pointer.py diff --git a/python/139-Word-Break.py b/python/0139-word-break.py similarity index 100% rename from python/139-Word-Break.py rename to python/0139-word-break.py diff --git a/python/141-Linked-List-Cycle.py b/python/0141-linked-list-cycle.py similarity index 100% rename from python/141-Linked-List-Cycle.py rename to python/0141-linked-list-cycle.py diff --git a/python/143-Reorder-List.py b/python/0143-reorder-list.py similarity index 100% rename from python/143-Reorder-List.py rename to python/0143-reorder-list.py diff --git a/python/146-LRU-Cache.py b/python/0146-lru-cache.py similarity index 100% rename from python/146-LRU-Cache.py rename to python/0146-lru-cache.py diff --git a/python/150-Evaluate-Reverse-Polish-Notation.py b/python/0150-evaluate-reverse-polish-notation.py similarity index 100% rename from python/150-Evaluate-Reverse-Polish-Notation.py rename to python/0150-evaluate-reverse-polish-notation.py diff --git a/python/152-Maximum-Product-Subarray.py b/python/0152-maximum-product-subarray.py similarity index 100% rename from python/152-Maximum-Product-Subarray.py rename to python/0152-maximum-product-subarray.py diff --git a/python/153-Find-Minimum-in-Rotated-Sorted-Array.py b/python/0153-find-minimum-in-rotated-sorted-array.py similarity index 100% rename from python/153-Find-Minimum-in-Rotated-Sorted-Array.py rename to python/0153-find-minimum-in-rotated-sorted-array.py diff --git a/python/155-Min-Stack.py b/python/0155-min-stack.py similarity index 100% rename from python/155-Min-Stack.py rename to python/0155-min-stack.py diff --git a/python/160-Intersection-of-Two-Linked-Lists.py b/python/0160-intersection-of-two-linked-lists.py similarity index 100% rename from python/160-Intersection-of-Two-Linked-Lists.py rename to python/0160-intersection-of-two-linked-lists.py diff --git a/python/167-Two-Sum-II.py b/python/0167-two-sum-ii-input-array-is-sorted.py similarity index 100% rename from python/167-Two-Sum-II.py rename to python/0167-two-sum-ii-input-array-is-sorted.py diff --git a/python/169-Majority-Element.py b/python/0169-majority-element.py similarity index 100% rename from python/169-Majority-Element.py rename to python/0169-majority-element.py diff --git a/python/190-Reverse-Bits.py b/python/0190-reverse-bits.py similarity index 100% rename from python/190-Reverse-Bits.py rename to python/0190-reverse-bits.py diff --git a/python/191-Number-of-1-Bits.py b/python/0191-number-of-1-bits.py similarity index 100% rename from python/191-Number-of-1-Bits.py rename to python/0191-number-of-1-bits.py diff --git a/python/198-House-Robber.py b/python/0198-house-robber.py similarity index 100% rename from python/198-House-Robber.py rename to python/0198-house-robber.py diff --git a/python/199-Binary-Tree-Right-Side-View.py b/python/0199-binary-tree-right-side-view.py similarity index 100% rename from python/199-Binary-Tree-Right-Side-View.py rename to python/0199-binary-tree-right-side-view.py diff --git a/python/200-Number-of-Islands.py b/python/0200-number-of-islands.py similarity index 100% rename from python/200-Number-of-Islands.py rename to python/0200-number-of-islands.py diff --git a/python/202-Happy-Number.py b/python/0202-happy-number.py similarity index 100% rename from python/202-Happy-Number.py rename to python/0202-happy-number.py diff --git a/python/205-Isomorphic-Strings.py b/python/0205-isomorphic-strings.py similarity index 100% rename from python/205-Isomorphic-Strings.py rename to python/0205-isomorphic-strings.py diff --git a/python/206-Reverse-Linked-List.py b/python/0206-reverse-linked-list.py similarity index 100% rename from python/206-Reverse-Linked-List.py rename to python/0206-reverse-linked-list.py diff --git a/python/207-Course-Schedule.py b/python/0207-course-schedule.py similarity index 100% rename from python/207-Course-Schedule.py rename to python/0207-course-schedule.py diff --git a/python/208-Implement-Trie.py b/python/0208-implement-trie-prefix-tree.py similarity index 100% rename from python/208-Implement-Trie.py rename to python/0208-implement-trie-prefix-tree.py diff --git a/python/210-Course-Schedule-II.py b/python/0210-course-schedule-ii.py similarity index 100% rename from python/210-Course-Schedule-II.py rename to python/0210-course-schedule-ii.py diff --git a/python/211-Design-Add-and-Search-Words-Data-Structure.py b/python/0211-design-add-and-search-words-data-structure.py similarity index 100% rename from python/211-Design-Add-and-Search-Words-Data-Structure.py rename to python/0211-design-add-and-search-words-data-structure.py diff --git a/python/212-Word-Search-II.py b/python/0212-word-search-ii.py similarity index 100% rename from python/212-Word-Search-II.py rename to python/0212-word-search-ii.py diff --git a/python/213-House-Robber-II.py b/python/0213-house-robber-ii.py similarity index 100% rename from python/213-House-Robber-II.py rename to python/0213-house-robber-ii.py diff --git a/python/215-Kth-Largest-Element-in-an-Array.py b/python/0215-kth-largest-element-in-an-array.py similarity index 100% rename from python/215-Kth-Largest-Element-in-an-Array.py rename to python/0215-kth-largest-element-in-an-array.py diff --git a/python/217-Contains-Duplicate.py b/python/0217-contains-duplicate.py similarity index 100% rename from python/217-Contains-Duplicate.py rename to python/0217-contains-duplicate.py diff --git a/python/221-Maximal-Square.py b/python/0221-maximal-square.py similarity index 100% rename from python/221-Maximal-Square.py rename to python/0221-maximal-square.py diff --git a/python/226-Invert-Binary-Tree.py b/python/0226-invert-binary-tree.py similarity index 100% rename from python/226-Invert-Binary-Tree.py rename to python/0226-invert-binary-tree.py diff --git a/python/230-Kth-Smallest-Element-in-a-BST.py b/python/0230-kth-smallest-element-in-a-bst.py similarity index 100% rename from python/230-Kth-Smallest-Element-in-a-BST.py rename to python/0230-kth-smallest-element-in-a-bst.py diff --git a/python/235-lowest-common-ancestor-of-a-binary-search-tree.py b/python/0235-lowest-common-ancestor-of-a-binary-search-tree.py similarity index 100% rename from python/235-lowest-common-ancestor-of-a-binary-search-tree.py rename to python/0235-lowest-common-ancestor-of-a-binary-search-tree.py diff --git a/python/238-Product-of-array-except-self.py b/python/0238-product-of-array-except-self.py similarity index 100% rename from python/238-Product-of-array-except-self.py rename to python/0238-product-of-array-except-self.py diff --git a/python/239-Sliding-Window-Maximum.py b/python/0239-sliding-window-maximum.py similarity index 100% rename from python/239-Sliding-Window-Maximum.py rename to python/0239-sliding-window-maximum.py diff --git a/python/242-Valid-Anagrams.py b/python/0242-valid-anagram.py similarity index 100% rename from python/242-Valid-Anagrams.py rename to python/0242-valid-anagram.py diff --git a/python/253-Meeting-Rooms-ii.py b/python/0253-meeting-rooms.py similarity index 100% rename from python/253-Meeting-Rooms-ii.py rename to python/0253-meeting-rooms.py diff --git a/python/261-Graph-Valid-Tree.py b/python/0261-graph-valid-tree.py similarity index 100% rename from python/261-Graph-Valid-Tree.py rename to python/0261-graph-valid-tree.py diff --git a/python/268-Missing-Number.py b/python/0268-missing-number.py similarity index 100% rename from python/268-Missing-Number.py rename to python/0268-missing-number.py diff --git a/python/269-Alien-Dictionary.py b/python/0269-alien-dictionary.py similarity index 100% rename from python/269-Alien-Dictionary.py rename to python/0269-alien-dictionary.py diff --git a/python/271-Encode-and-Decode-Strings.py b/python/0271-encode-and-decode-strings.py similarity index 100% rename from python/271-Encode-and-Decode-Strings.py rename to python/0271-encode-and-decode-strings.py diff --git a/python/286-Walls-and-Gates.py b/python/0286-walls-and-gates.py similarity index 100% rename from python/286-Walls-and-Gates.py rename to python/0286-walls-and-gates.py diff --git a/python/287-Find-The-Duplicate-Number.py b/python/0287-find-the-duplicate-number.py similarity index 100% rename from python/287-Find-The-Duplicate-Number.py rename to python/0287-find-the-duplicate-number.py diff --git a/python/290-Word-Pattern.py b/python/0290-word-pattern.py similarity index 100% rename from python/290-Word-Pattern.py rename to python/0290-word-pattern.py diff --git a/python/295-Find-Median-from-Data-Stream.py b/python/0295-find-median-from-data-stream.py similarity index 100% rename from python/295-Find-Median-from-Data-Stream.py rename to python/0295-find-median-from-data-stream.py diff --git a/python/297-Serialize-and-Deserialize-Binary-Tree.py b/python/0297-serialize-and-deserialize-binary-tree.py similarity index 100% rename from python/297-Serialize-and-Deserialize-Binary-Tree.py rename to python/0297-serialize-and-deserialize-binary-tree.py diff --git a/python/300-Longest-Increasing-Subsequence.py b/python/0300-longest-increasing-subsequence.py similarity index 100% rename from python/300-Longest-Increasing-Subsequence.py rename to python/0300-longest-increasing-subsequence.py diff --git a/python/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py b/python/0309-best-time-to-buy-and-sell-stock-with-cooldown.py similarity index 100% rename from python/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py rename to python/0309-best-time-to-buy-and-sell-stock-with-cooldown.py diff --git a/python/312-Burst-Balloons.py b/python/0312-burst-balloons.py similarity index 100% rename from python/312-Burst-Balloons.py rename to python/0312-burst-balloons.py diff --git a/python/322-Coin-Change.py b/python/0322-coin-change.py similarity index 100% rename from python/322-Coin-Change.py rename to python/0322-coin-change.py diff --git a/python/323-Number-of-Connected-Components-in-an-Undirected-Graph.py b/python/0323-number-of-connected-components-in-an-undirected-graph.py similarity index 100% rename from python/323-Number-of-Connected-Components-in-an-Undirected-Graph.py rename to python/0323-number-of-connected-components-in-an-undirected-graph.py diff --git a/python/329-Longest-Increasing-Path-in-a-Matrix.py b/python/0329-longest-increasing-path-in-a-matrix.py similarity index 100% rename from python/329-Longest-Increasing-Path-in-a-Matrix.py rename to python/0329-longest-increasing-path-in-a-matrix.py diff --git a/python/332-Reconstruct-Itinerary.py b/python/0332-reconstruct-itinerary.py similarity index 100% rename from python/332-Reconstruct-Itinerary.py rename to python/0332-reconstruct-itinerary.py diff --git a/python/338-Counting-Bits.py b/python/0338-counting-bits.py similarity index 100% rename from python/338-Counting-Bits.py rename to python/0338-counting-bits.py diff --git a/python/344-Reverse-String.py b/python/0344-reverse-string.py similarity index 100% rename from python/344-Reverse-String.py rename to python/0344-reverse-string.py diff --git a/python/347-Top-k-frequent-elements.py b/python/0347-top-k-frequent-elements.py similarity index 100% rename from python/347-Top-k-frequent-elements.py rename to python/0347-top-k-frequent-elements.py diff --git a/python/355-Design-Twitter.py b/python/0355-design-twitter.py similarity index 100% rename from python/355-Design-Twitter.py rename to python/0355-design-twitter.py diff --git a/python/367-Valid-Perfect-Square.py b/python/0367-valid-perfect-square.py similarity index 100% rename from python/367-Valid-Perfect-Square.py rename to python/0367-valid-perfect-square.py diff --git a/python/371-Sum-of-Two-Integers.py b/python/0371-sum-of-two-integers.py similarity index 100% rename from python/371-Sum-of-Two-Integers.py rename to python/0371-sum-of-two-integers.py diff --git a/python/374-Guess-Number-Higher-Or-Lower.py b/python/0374-guess-number-higher-or-lower.py similarity index 100% rename from python/374-Guess-Number-Higher-Or-Lower.py rename to python/0374-guess-number-higher-or-lower.py diff --git a/python/377-Combination-Sum-IV.py b/python/0377-combination-sum-iv.py similarity index 100% rename from python/377-Combination-Sum-IV.py rename to python/0377-combination-sum-iv.py diff --git a/python/392-Is-Subsequence.py b/python/0392-is-subsequence.py similarity index 100% rename from python/392-Is-Subsequence.py rename to python/0392-is-subsequence.py diff --git a/python/394-decode-string.py b/python/0394-decode-string.py similarity index 100% rename from python/394-decode-string.py rename to python/0394-decode-string.py diff --git a/python/410-Split-Array-Largest-Sum.py b/python/0410-split-array-largest-sum.py similarity index 100% rename from python/410-Split-Array-Largest-Sum.py rename to python/0410-split-array-largest-sum.py diff --git a/python/416-Partition-Equal-Subset-Sum.py b/python/0416-partition-equal-subset-sum.py similarity index 100% rename from python/416-Partition-Equal-Subset-Sum.py rename to python/0416-partition-equal-subset-sum.py diff --git a/python/417-Pacific-Atlantic-Waterflow.py b/python/0417-pacific-atlantic-water-flow.py similarity index 100% rename from python/417-Pacific-Atlantic-Waterflow.py rename to python/0417-pacific-atlantic-water-flow.py diff --git a/python/424-Longest-Repeating-Character-Replacement.py b/python/0424-longest-repeating-character-replacement.py similarity index 100% rename from python/424-Longest-Repeating-Character-Replacement.py rename to python/0424-longest-repeating-character-replacement.py diff --git a/python/435-Non-Overlapping-Intervals.py b/python/0435-non-overlapping-intervals.py similarity index 100% rename from python/435-Non-Overlapping-Intervals.py rename to python/0435-non-overlapping-intervals.py diff --git a/python/438-Find-All-Anagrams-In-A-String.py b/python/0438-find-all-anagrams-in-a-string.py similarity index 100% rename from python/438-Find-All-Anagrams-In-A-String.py rename to python/0438-find-all-anagrams-in-a-string.py diff --git a/python/441-Arranging-Coin.py b/python/0441-arranging-coins.py similarity index 100% rename from python/441-Arranging-Coin.py rename to python/0441-arranging-coins.py diff --git a/python/448-Find-all-Numbers-Disappeared-in-an-Array.py b/python/0448-find-all-numbers-disappeared-in-an-array.py similarity index 100% rename from python/448-Find-all-Numbers-Disappeared-in-an-Array.py rename to python/0448-find-all-numbers-disappeared-in-an-array.py diff --git a/python/463-Island-Perimeter.py b/python/0463-island-perimeter.py similarity index 100% rename from python/463-Island-Perimeter.py rename to python/0463-island-perimeter.py diff --git a/python/473-Matchsticks-to-Square.py b/python/0473-matchsticks-to-square.py similarity index 100% rename from python/473-Matchsticks-to-Square.py rename to python/0473-matchsticks-to-square.py diff --git a/python/494-Target-Sum.py b/python/0494-target-sum.py similarity index 100% rename from python/494-Target-Sum.py rename to python/0494-target-sum.py diff --git a/python/496-Next-Greater-Element-I.py b/python/0496-next-greater-element-i.py similarity index 100% rename from python/496-Next-Greater-Element-I.py rename to python/0496-next-greater-element-i.py diff --git a/python/518-coin-change-2.py b/python/0518-coin-change-ii.py similarity index 100% rename from python/518-coin-change-2.py rename to python/0518-coin-change-ii.py diff --git a/python/523-Continuous-Subarray-Sum.py b/python/0523-continuous-subarray-sum.py similarity index 100% rename from python/523-Continuous-Subarray-Sum.py rename to python/0523-continuous-subarray-sum.py diff --git a/python/543-Diameter-of-Binary-Tree.py b/python/0543-diameter-of-binary-tree.py similarity index 100% rename from python/543-Diameter-of-Binary-Tree.py rename to python/0543-diameter-of-binary-tree.py diff --git a/python/567-Permutation-in-String.py b/python/0567-permutation-in-string.py similarity index 100% rename from python/567-Permutation-in-String.py rename to python/0567-permutation-in-string.py diff --git a/python/572-Subtree-of-Another-Tree.py b/python/0572-subtree-of-another-tree.py similarity index 100% rename from python/572-Subtree-of-Another-Tree.py rename to python/0572-subtree-of-another-tree.py diff --git a/python/605-Can-Place-Flowers.py b/python/0605-can-place-flowers.py similarity index 100% rename from python/605-Can-Place-Flowers.py rename to python/0605-can-place-flowers.py diff --git a/python/617-Merge-Two-Binary-Trees.py b/python/0617-merge-two-binary-trees.py similarity index 100% rename from python/617-Merge-Two-Binary-Trees.py rename to python/0617-merge-two-binary-trees.py diff --git a/python/621-Task-Scheduler.py b/python/0621-task-scheduler.py similarity index 100% rename from python/621-Task-Scheduler.py rename to python/0621-task-scheduler.py diff --git a/python/647-Palindromic-Substrings.py b/python/0647-palindromic-substrings.py similarity index 100% rename from python/647-Palindromic-Substrings.py rename to python/0647-palindromic-substrings.py diff --git a/python/658-Find-K-Closest-Elements.py b/python/0658-find-k-closest-elements.py similarity index 100% rename from python/658-Find-K-Closest-Elements.py rename to python/0658-find-k-closest-elements.py diff --git a/python/669-Trim-a-Binary-Search-Tree.py b/python/0669-trim-a-binary-search-tree.py similarity index 100% rename from python/669-Trim-a-Binary-Search-Tree.py rename to python/0669-trim-a-binary-search-tree.py diff --git a/python/673-Number-of-Longest-Increasing-Subsequence.py b/python/0673-number-of-longest-increasing-subsequence.py similarity index 100% rename from python/673-Number-of-Longest-Increasing-Subsequence.py rename to python/0673-number-of-longest-increasing-subsequence.py diff --git a/python/678-Valid-Parenthesis-String.py b/python/0678-valid-parenthesis-string.py similarity index 100% rename from python/678-Valid-Parenthesis-String.py rename to python/0678-valid-parenthesis-string.py diff --git a/python/680-Valid-Palindrome-II.py b/python/0680-valid-palindrome-ii.py similarity index 100% rename from python/680-Valid-Palindrome-II.py rename to python/0680-valid-palindrome-ii.py diff --git a/python/682-Baseball-Game.py b/python/0682-baseball-game.py similarity index 100% rename from python/682-Baseball-Game.py rename to python/0682-baseball-game.py diff --git a/python/684-Redundant-Connection.py b/python/0684-redundant-connection.py similarity index 100% rename from python/684-Redundant-Connection.py rename to python/0684-redundant-connection.py diff --git a/python/695-Max-Area-of-Island.py b/python/0695-max-area-of-island.py similarity index 100% rename from python/695-Max-Area-of-Island.py rename to python/0695-max-area-of-island.py diff --git a/python/703-Kth-Largest-Element-in-a-Stream.py b/python/0703-kth-largest-element-in-a-stream.py similarity index 100% rename from python/703-Kth-Largest-Element-in-a-Stream.py rename to python/0703-kth-largest-element-in-a-stream.py diff --git a/python/704-Binary-Search.py b/python/0704-binary-search.py similarity index 100% rename from python/704-Binary-Search.py rename to python/0704-binary-search.py diff --git a/python/724-Find-Pivot-Index.py b/python/0724-find-pivot-index.py similarity index 100% rename from python/724-Find-Pivot-Index.py rename to python/0724-find-pivot-index.py diff --git a/python/739-Daily-Temperatures.py b/python/0739-daily-temperatures.py similarity index 100% rename from python/739-Daily-Temperatures.py rename to python/0739-daily-temperatures.py diff --git a/python/743-Network-Delay-Time.py b/python/0743-network-delay-time.py similarity index 100% rename from python/743-Network-Delay-Time.py rename to python/0743-network-delay-time.py diff --git a/python/746-Min-Cost-Climbing-Stairs.py b/python/0746-min-cost-climbing-stairs.py similarity index 100% rename from python/746-Min-Cost-Climbing-Stairs.py rename to python/0746-min-cost-climbing-stairs.py diff --git a/python/752-Open-the-Lock.py b/python/0752-open-the-lock.py similarity index 100% rename from python/752-Open-the-Lock.py rename to python/0752-open-the-lock.py diff --git a/python/763-Partition-Labels.py b/python/0763-partition-labels.py similarity index 100% rename from python/763-Partition-Labels.py rename to python/0763-partition-labels.py diff --git a/python/767-Reorganize-String.py b/python/0767-reorganize-string.py similarity index 100% rename from python/767-Reorganize-String.py rename to python/0767-reorganize-string.py diff --git a/python/778-Swim-in-Rising-Water.py b/python/0778-swim-in-rising-water.py similarity index 100% rename from python/778-Swim-in-Rising-Water.py rename to python/0778-swim-in-rising-water.py diff --git a/python/787-Cheapest-Flights-within-K-stops.py b/python/0787-cheapest-flights-within-k-stops.py similarity index 100% rename from python/787-Cheapest-Flights-within-K-stops.py rename to python/0787-cheapest-flights-within-k-stops.py diff --git a/python/846-Hand-of-Straights.py b/python/0846-hand-of-straights.py similarity index 100% rename from python/846-Hand-of-Straights.py rename to python/0846-hand-of-straights.py diff --git a/python/853-Car-Fleet.py b/python/0853-car-fleet.py similarity index 100% rename from python/853-Car-Fleet.py rename to python/0853-car-fleet.py diff --git a/python/875-Koko-Eating-Bananas.py b/python/0875-koko-eating-bananas.py similarity index 100% rename from python/875-Koko-Eating-Bananas.py rename to python/0875-koko-eating-bananas.py diff --git a/python/901-Online-Stock-Span.py b/python/0901-online-stock-span.py similarity index 100% rename from python/901-Online-Stock-Span.py rename to python/0901-online-stock-span.py diff --git a/python/909-Snakes-and-Ladders.py b/python/0909-snakes-and-ladders.py similarity index 100% rename from python/909-Snakes-and-Ladders.py rename to python/0909-snakes-and-ladders.py diff --git a/python/919-Meeting-Rooms-II.py b/python/0919-meeting-rooms-ii.py similarity index 100% rename from python/919-Meeting-Rooms-II.py rename to python/0919-meeting-rooms-ii.py diff --git a/python/929-Unique-Email-Addresses.py b/python/0929-unique-email-addresses.py similarity index 100% rename from python/929-Unique-Email-Addresses.py rename to python/0929-unique-email-addresses.py diff --git a/python/973-K-Closest-Points-to-Origin.py b/python/0973-k-closest-points-to-origin.py similarity index 100% rename from python/973-K-Closest-Points-to-Origin.py rename to python/0973-k-closest-points-to-origin.py diff --git a/python/977-Squares-Of-A-Sorted-Array.py b/python/0977-squares-of-a-sorted-array.py similarity index 100% rename from python/977-Squares-Of-A-Sorted-Array.py rename to python/0977-squares-of-a-sorted-array.py diff --git a/python/981-Time-Based-Key-Value-Store.py b/python/0981-time-based-key-value-store.py similarity index 100% rename from python/981-Time-Based-Key-Value-Store.py rename to python/0981-time-based-key-value-store.py diff --git a/python/994-Rotting-Oranges.py b/python/0994-rotting-oranges.py similarity index 100% rename from python/994-Rotting-Oranges.py rename to python/0994-rotting-oranges.py diff --git a/python/1046-last-stone-weight.py b/python/1046-last-stone-weight.py new file mode 100644 index 000000000..ac5b574d7 --- /dev/null +++ b/python/1046-last-stone-weight.py @@ -0,0 +1,13 @@ +class Solution: + def lastStoneWeight(self, stones: List[int]) -> int: + stones = [-s for s in stones] + heapq.heapify(stones) + + while len(stones) > 1: + first = heapq.heappop(stones) + second = heapq.heappop(stones) + if second > first: + heapq.heappush(stones, first - second) + + stones.append(0) + return abs(stones[0]) diff --git a/python/1143-longest-common-subsequence.py b/python/1143-longest-common-subsequence.py new file mode 100644 index 000000000..0860720a5 --- /dev/null +++ b/python/1143-longest-common-subsequence.py @@ -0,0 +1,12 @@ +class Solution: + def longestCommonSubsequence(self, text1: str, text2: str) -> int: + dp = [[0 for j in range(len(text2) + 1)] for i in range(len(text1) + 1)] + + for i in range(len(text1) - 1, -1, -1): + for j in range(len(text2) - 1, -1, -1): + if text1[i] == text2[j]: + dp[i][j] = 1 + dp[i + 1][j + 1] + else: + dp[i][j] = max(dp[i][j + 1], dp[i + 1][j]) + + return dp[0][0] diff --git a/python/1189-maximum-number-of-balloons.py b/python/1189-maximum-number-of-balloons.py new file mode 100644 index 000000000..8095afef8 --- /dev/null +++ b/python/1189-maximum-number-of-balloons.py @@ -0,0 +1,12 @@ +from collections import Counter + + +class Solution: + def maxNumberOfBalloons(self, text: str) -> int: + countText = Counter(text) + balloon = Counter("balloon") + + res = len(text) # or float("inf") + for c in balloon: + res = min(res, countText[c] // balloon[c]) + return res diff --git a/python/1209-remove-all-adjacent-duplicates-in-string-ii.py b/python/1209-remove-all-adjacent-duplicates-in-string-ii.py new file mode 100644 index 000000000..4356c4c28 --- /dev/null +++ b/python/1209-remove-all-adjacent-duplicates-in-string-ii.py @@ -0,0 +1,18 @@ +class Solution: + def removeDuplicates(self, s: str, k: int) -> str: + stack = [] # [char, count] + + for c in s: + if stack and stack[-1][0] == c: + stack[-1][1] += 1 + else: + stack.append([c, 1]) + + if stack[-1][1] == k: + stack.pop() + + res = "" + for char, count in stack: + res += char * count + + return res diff --git a/python/1220-count-vowels-permutation.py b/python/1220-count-vowels-permutation.py new file mode 100644 index 000000000..845da7a03 --- /dev/null +++ b/python/1220-count-vowels-permutation.py @@ -0,0 +1,39 @@ +class Solution: + Memo = {} + def countVowelPermutation(self, n, c = '') -> int: + if (c, n) in self.Memo: + return self.Memo[(c, n)] + if n == 1: + if c == 'a': + return 1 + if c == 'e': + return 2 + if c == 'i': + return 4 + if c == 'o': + return 2 + if c == 'u': + return 1 + if c == '': + return 5 + else: + if c == 'a': + self.Memo[('a', n)] = self.countVowelPermutation(n - 1, 'e') + return self.Memo[('a', n)] + if c == 'e': + self.Memo[('e', n)] = self.countVowelPermutation(n - 1, 'a') + self.countVowelPermutation(n - 1, 'i') + return self.Memo[('e', n)] + if c == 'i': + self.Memo[('i', n)] = self.countVowelPermutation(n - 1, 'a') + self.countVowelPermutation(n - 1, 'e') + self.countVowelPermutation(n - 1, 'o') + self.countVowelPermutation(n - 1, 'u') + return self.Memo[('i', n)] + if c == 'o': + self.Memo[('o', n)] = self.countVowelPermutation(n - 1, 'i') + self.countVowelPermutation(n - 1, 'u') + return self.Memo[('o', n)] + if c == 'u': + self.Memo[('u', n)] = self.countVowelPermutation(n - 1, 'a') + return self.Memo[('u', n)] + if c == '': + Tot = 0 + for i in ['a', 'e', 'i', 'o', 'u']: + Tot = Tot + self.countVowelPermutation(n - 1, i); + return Tot % 1000000007 diff --git a/python/1239-maximum-length-of-a-concatenated-string-with-unique-characters.py b/python/1239-maximum-length-of-a-concatenated-string-with-unique-characters.py new file mode 100644 index 000000000..559af2295 --- /dev/null +++ b/python/1239-maximum-length-of-a-concatenated-string-with-unique-characters.py @@ -0,0 +1,27 @@ +class Solution: + def maxLength(self, arr: List[str]) -> int: + charSet = set() + + def overlap(charSet, s): + c = Counter(charSet) + Counter(s) + return max(c.values()) > 1 + # prev = set() + # for c in s: + # if c in charSet or c in prev: + # return True + # prev.add(c) + # return False + + def backtrack(i): + if i == len(arr): + return len(charSet) + res = 0 + if not overlap(charSet, arr[i]): + for c in arr[i]: + charSet.add(c) + res = backtrack(i + 1) + for c in arr[i]: + charSet.remove(c) + return max(res, backtrack(i + 1)) # dont concatenate arr[i] + + return backtrack(0) diff --git a/python/1299-replace-elements-with-greatest-element-on-right-side.py b/python/1299-replace-elements-with-greatest-element-on-right-side.py new file mode 100644 index 000000000..ff92025fb --- /dev/null +++ b/python/1299-replace-elements-with-greatest-element-on-right-side.py @@ -0,0 +1,8 @@ +class Solution: + def replaceElements(self, arr: List[int]) -> List[int]: + rightMax = -1 + for i in range(len(arr) -1, -1, -1): + newMax = max(rightMax, arr[i]) + arr[i] = rightMax + rightMax = newMax + return arr diff --git a/python/1383-maximum-performance-of-a-team.py b/python/1383-maximum-performance-of-a-team.py new file mode 100644 index 000000000..b093b0c9c --- /dev/null +++ b/python/1383-maximum-performance-of-a-team.py @@ -0,0 +1,18 @@ +class Solution: + def maxPerformance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: + mod = 10 ** 9 + 7 + eng = [] + for eff, spd in zip(efficiency, speed): + eng.append([eff, spd]) + eng.sort(reverse = True) + + res, speed = 0, 0 + minHeap = [] + + for eff, spd in eng: + if len(minHeap) == k: + speed -= heapq.heappop(minHeap) + speed += spd + heapq.heappush(minHeap, spd) + res = max(res, eff * speed) + return res % mod diff --git a/python/1448-count-good-nodes-in-binary-tree.py b/python/1448-count-good-nodes-in-binary-tree.py new file mode 100644 index 000000000..4fce28f4e --- /dev/null +++ b/python/1448-count-good-nodes-in-binary-tree.py @@ -0,0 +1,19 @@ +# Definition for a binary tree node. +# class TreeNode: +# def __init__(self, val=0, left=None, right=None): +# self.val = val +# self.left = left +# self.right = right +class Solution: + def goodNodes(self, root: TreeNode) -> int: + def dfs(node, maxVal): + if not node: + return 0 + + res = 1 if node.val >= maxVal else 0 + maxVal = max(maxVal, node.val) + res += dfs(node.left, maxVal) + res += dfs(node.right, maxVal) + return res + + return dfs(root, root.val) diff --git a/python/1584-min-cost-to-connect-all-points.py b/python/1584-min-cost-to-connect-all-points.py new file mode 100644 index 000000000..0ad2e2fc0 --- /dev/null +++ b/python/1584-min-cost-to-connect-all-points.py @@ -0,0 +1,26 @@ +class Solution: + def minCostConnectPoints(self, points: List[List[int]]) -> int: + N = len(points) + adj = {i: [] for i in range(N)} # i : list of [cost, node] + for i in range(N): + x1, y1 = points[i] + for j in range(i + 1, N): + x2, y2 = points[j] + dist = abs(x1 - x2) + abs(y1 - y2) + adj[i].append([dist, j]) + adj[j].append([dist, i]) + + # Prim's + res = 0 + visit = set() + minH = [[0, 0]] # [cost, point] + while len(visit) < N: + cost, i = heapq.heappop(minH) + if i in visit: + continue + res += cost + visit.add(i) + for neiCost, nei in adj[i]: + if nei not in visit: + heapq.heappush(minH, [neiCost, nei]) + return res diff --git a/python/1845-seat-reservation-manager.py b/python/1845-seat-reservation-manager.py new file mode 100644 index 000000000..0b2badfe3 --- /dev/null +++ b/python/1845-seat-reservation-manager.py @@ -0,0 +1,12 @@ +import heapq + +class SeatManager: + + def __init__(self, n: int): + self.seats = [i for i in range(1, n + 1)] + + def reserve(self) -> int: + return heapq.heappop(self.seats) + + def unreserve(self, seatNumber: int) -> None: + heapq.heappush(self.seats, seatNumber) \ No newline at end of file diff --git a/python/1849-splitting-a-string-into-descending-consecutive-values.py b/python/1849-splitting-a-string-into-descending-consecutive-values.py new file mode 100644 index 000000000..104e7b6fd --- /dev/null +++ b/python/1849-splitting-a-string-into-descending-consecutive-values.py @@ -0,0 +1,18 @@ +class Solution: + def splitString(self, s: str) -> bool: + + def dfs(index, prev): + if index == len(s): + return True + + for j in range(index, len(s)): + val = int(s[index:j+1]) + if val + 1 == prev and dfs(j+1, val): + return True + return False + + for i in range(len(s) - 1): + val = int(s[:i + 1]) + if dfs(i+1, val): return True + + return False diff --git a/python/1851-minimum-interval-to-include-each-query.py b/python/1851-minimum-interval-to-include-each-query.py new file mode 100644 index 000000000..545cefaa2 --- /dev/null +++ b/python/1851-minimum-interval-to-include-each-query.py @@ -0,0 +1,16 @@ +class Solution: + def minInterval(self, intervals: List[List[int]], queries: List[int]) -> List[int]: + intervals.sort() + minHeap = [] + res = {} + i = 0 + for q in sorted(queries): + while i < len(intervals) and intervals[i][0] <= q: + l, r = intervals[i] + heapq.heappush(minHeap, (r - l + 1, r)) + i += 1 + + while minHeap and minHeap[0][1] < q: + heapq.heappop(minHeap) + res[q] = minHeap[0][0] if minHeap else -1 + return [res[q] for q in queries] diff --git a/python/1905-count-sub-islands.py b/python/1905-count-sub-islands.py new file mode 100644 index 000000000..4cb0b42e9 --- /dev/null +++ b/python/1905-count-sub-islands.py @@ -0,0 +1,33 @@ +class Solution: + def countSubIslands(self, grid1: List[List[int]], grid2: List[List[int]]) -> int: + ROWS, COLS = len(grid1), len(grid1[0]) + visit = set() + + def dfs(r, c): + if ( + r < 0 + or c < 0 + or r == ROWS + or c == COLS + or grid2[r][c] == 0 + or (r, c) in visit + ): + return True + + visit.add((r, c)) + res = True + if grid1[r][c] == 0: + res = False + + res = dfs(r - 1, c) and res + res = dfs(r + 1, c) and res + res = dfs(r, c - 1) and res + res = dfs(r, c + 1) and res + return res + + count = 0 + for r in range(ROWS): + for c in range(COLS): + if grid2[r][c] and (r, c) not in visit and dfs(r, c): + count += 1 + return count diff --git a/python/1980-find-unique-binary-string.py b/python/1980-find-unique-binary-string.py new file mode 100644 index 000000000..f91519ae3 --- /dev/null +++ b/python/1980-find-unique-binary-string.py @@ -0,0 +1,19 @@ +class Solution: + def findDifferentBinaryString(self, nums: List[str]) -> str: + + strSet = { s for s in nums } + + def backtrack(i, cur): + if i == len(nums): + res = "".join(cur) + return None if res in strSet else res + + res = backtrack(i+1, cur) + if res: return res + + cur[i] = "1" + res = backtrack(i+1, cur) + if res: return res + + return backtrack(0, ["0" for s in nums]) + diff --git a/python/1985-find-the-kth-largest-integer-in-the-array.py b/python/1985-find-the-kth-largest-integer-in-the-array.py new file mode 100644 index 000000000..338c279b0 --- /dev/null +++ b/python/1985-find-the-kth-largest-integer-in-the-array.py @@ -0,0 +1,8 @@ +class Solution: + def kthLargestNumber(self, nums: List[str], k: int) -> str: + maxHeap = [-int(n) for n in nums] + heapq.heapify(maxHeap) + while k>1: + heapq.heappop(maxHeap) + k-=1 + return str(-maxHeap[0]) diff --git a/python/2013-detect-squares.py b/python/2013-detect-squares.py new file mode 100644 index 000000000..8230830d2 --- /dev/null +++ b/python/2013-detect-squares.py @@ -0,0 +1,17 @@ +class DetectSquares: + def __init__(self): + self.ptsCount = defaultdict(int) + self.pts = [] + + def add(self, point: List[int]) -> None: + self.ptsCount[tuple(point)] += 1 + self.pts.append(point) + + def count(self, point: List[int]) -> int: + res = 0 + px, py = point + for x, y in self.pts: + if (abs(py - y) != abs(px - x)) or x == px or y == py: + continue + res += self.ptsCount[(x, py)] * self.ptsCount[(px, y)] + return res diff --git a/python/2017-grid-game.py b/python/2017-grid-game.py new file mode 100644 index 000000000..edce10fdb --- /dev/null +++ b/python/2017-grid-game.py @@ -0,0 +1,12 @@ +# Time: O(n) Space: O(1) + +class Solution(object): + def gridGame(self, grid): + result = float("inf") + left, right = 0, sum(grid[0]) + + for a, b in zip(grid[0], grid[1]): + right -= a + result = min(result, max(left, right)) + left += b + return result diff --git a/ruby/1-Two-Sum.rb b/ruby/0001-two-sum.rb similarity index 100% rename from ruby/1-Two-Sum.rb rename to ruby/0001-two-sum.rb diff --git a/ruby/2-Add-Two-Numbers.rb b/ruby/0002-add-two-numbers.rb similarity index 100% rename from ruby/2-Add-Two-Numbers.rb rename to ruby/0002-add-two-numbers.rb diff --git a/ruby/3-Longest-Substring-Without-Repeating-Characters.rb b/ruby/0003-longest-substring-without-repeating-characters.rb similarity index 100% rename from ruby/3-Longest-Substring-Without-Repeating-Characters.rb rename to ruby/0003-longest-substring-without-repeating-characters.rb diff --git a/ruby/7-Reverse-Integer.rb b/ruby/0007-reverse-integer.rb similarity index 100% rename from ruby/7-Reverse-Integer.rb rename to ruby/0007-reverse-integer.rb diff --git a/ruby/11-Container-With-Most-Water.rb b/ruby/0011-container-with-most-water.rb similarity index 100% rename from ruby/11-Container-With-Most-Water.rb rename to ruby/0011-container-with-most-water.rb diff --git a/ruby/15-3Sum.rb b/ruby/0015-3sum.rb similarity index 100% rename from ruby/15-3Sum.rb rename to ruby/0015-3sum.rb diff --git a/ruby/17-Letter-Combinations-Of-A-Phone-Number.rb b/ruby/0017-letter-combinations-of-a-phone-number.rb similarity index 100% rename from ruby/17-Letter-Combinations-Of-A-Phone-Number.rb rename to ruby/0017-letter-combinations-of-a-phone-number.rb diff --git a/ruby/20-Valid-Parentheses.rb b/ruby/0020-valid-parentheses.rb similarity index 100% rename from ruby/20-Valid-Parentheses.rb rename to ruby/0020-valid-parentheses.rb diff --git a/ruby/21-Merge-Two-Sorted-Lists.rb b/ruby/0021-merge-two-sorted-lists.rb similarity index 100% rename from ruby/21-Merge-Two-Sorted-Lists.rb rename to ruby/0021-merge-two-sorted-lists.rb diff --git a/ruby/22-Generate-Parentheses.rb b/ruby/0022-generate-parentheses.rb similarity index 100% rename from ruby/22-Generate-Parentheses.rb rename to ruby/0022-generate-parentheses.rb diff --git a/ruby/36-Valid-Sudoku.rb b/ruby/0036-valid-sudoku.rb similarity index 100% rename from ruby/36-Valid-Sudoku.rb rename to ruby/0036-valid-sudoku.rb diff --git a/ruby/42-Trapping-Rain-Water.rb b/ruby/0042-trapping-rain-water.rb similarity index 100% rename from ruby/42-Trapping-Rain-Water.rb rename to ruby/0042-trapping-rain-water.rb diff --git a/ruby/49-Group-Anagrams.rb b/ruby/0049-group-anagrams.rb similarity index 100% rename from ruby/49-Group-Anagrams.rb rename to ruby/0049-group-anagrams.rb diff --git a/ruby/0053-maximum-subarray.rb b/ruby/0053-maximum-subarray.rb new file mode 100644 index 000000000..e94c2c81d --- /dev/null +++ b/ruby/0053-maximum-subarray.rb @@ -0,0 +1,13 @@ +def max_sub_array(nums) + sum = 0 + max = -10 * 10 * 10 * 10 - 1 + + nums.each do |num| + sum += num + max = sum > max ? sum : max + + sum = 0 if sum < 0 + end + + max +end diff --git a/ruby/70-Climbing-Stairs.rb b/ruby/0070-climbing-stairs.rb similarity index 100% rename from ruby/70-Climbing-Stairs.rb rename to ruby/0070-climbing-stairs.rb diff --git a/ruby/74-Search-a-2D-Matrix.rb b/ruby/0074-search-a-2d-matrix.rb similarity index 100% rename from ruby/74-Search-a-2D-Matrix.rb rename to ruby/0074-search-a-2d-matrix.rb diff --git a/ruby/78-Subsets.rb b/ruby/0078-subsets.rb similarity index 100% rename from ruby/78-Subsets.rb rename to ruby/0078-subsets.rb diff --git a/ruby/94-Binary-Tree-Inorder-Traversal.rb b/ruby/0094-binary-tree-inorder-traversal.rb similarity index 100% rename from ruby/94-Binary-Tree-Inorder-Traversal.rb rename to ruby/0094-binary-tree-inorder-traversal.rb diff --git a/ruby/100-Same-Tree.rb b/ruby/0100-same-tree.rb similarity index 100% rename from ruby/100-Same-Tree.rb rename to ruby/0100-same-tree.rb diff --git a/ruby/102-Binary-Tree-Level-Order-Traversal.rb b/ruby/0102-binary-tree-level-order-traversal.rb similarity index 100% rename from ruby/102-Binary-Tree-Level-Order-Traversal.rb rename to ruby/0102-binary-tree-level-order-traversal.rb diff --git a/ruby/104-Maximum-Depth-of-Binary-Tree.rb b/ruby/0104-maximum-depth-of-binary-tree.rb similarity index 100% rename from ruby/104-Maximum-Depth-of-Binary-Tree.rb rename to ruby/0104-maximum-depth-of-binary-tree.rb diff --git a/ruby/110-Balanced-Binary-Tree.rb b/ruby/0110-balanced-binary-tree.rb similarity index 100% rename from ruby/110-Balanced-Binary-Tree.rb rename to ruby/0110-balanced-binary-tree.rb diff --git a/ruby/121-Best-Time-To-Buy-and-Sell-Stock.rb b/ruby/0121-best-time-to-buy-and-sell-stock.rb similarity index 100% rename from ruby/121-Best-Time-To-Buy-and-Sell-Stock.rb rename to ruby/0121-best-time-to-buy-and-sell-stock.rb diff --git a/ruby/125-Valid-Palindrome.rb b/ruby/0125-valid-palindrome.rb similarity index 100% rename from ruby/125-Valid-Palindrome.rb rename to ruby/0125-valid-palindrome.rb diff --git a/ruby/128-Longest-consecutive-sequence.rb b/ruby/0128-longest-consecutive-sequence.rb similarity index 100% rename from ruby/128-Longest-consecutive-sequence.rb rename to ruby/0128-longest-consecutive-sequence.rb diff --git a/ruby/133-Clone-Graph.rb b/ruby/0133-clone-graph.rb similarity index 100% rename from ruby/133-Clone-Graph.rb rename to ruby/0133-clone-graph.rb diff --git a/ruby/136-Single-Number.rb b/ruby/0136-single-number.rb similarity index 100% rename from ruby/136-Single-Number.rb rename to ruby/0136-single-number.rb diff --git a/ruby/138-Copy-List-With-Random-Pointer.rb b/ruby/0138-copy-list-with-random-pointer.rb similarity index 100% rename from ruby/138-Copy-List-With-Random-Pointer.rb rename to ruby/0138-copy-list-with-random-pointer.rb diff --git a/ruby/141-Linked-List-Cycle.rb b/ruby/0141-linked-list-cycle.rb similarity index 100% rename from ruby/141-Linked-List-Cycle.rb rename to ruby/0141-linked-list-cycle.rb diff --git a/ruby/146-LRU-Cache.rb b/ruby/0146-lru-cache.rb similarity index 100% rename from ruby/146-LRU-Cache.rb rename to ruby/0146-lru-cache.rb diff --git a/ruby/150-Evaluate-Reverse-Polish-Notation.rb b/ruby/0150-evaluate-reverse-polish-notation.rb similarity index 100% rename from ruby/150-Evaluate-Reverse-Polish-Notation.rb rename to ruby/0150-evaluate-reverse-polish-notation.rb diff --git a/ruby/152-Maximum-Product-Subarray.rb b/ruby/0152-maximum-product-subarray.rb similarity index 100% rename from ruby/152-Maximum-Product-Subarray.rb rename to ruby/0152-maximum-product-subarray.rb diff --git a/ruby/155-Min-Stack.rb b/ruby/0155-min-stack.rb similarity index 100% rename from ruby/155-Min-Stack.rb rename to ruby/0155-min-stack.rb diff --git a/ruby/167-Two-Sum-II.rb b/ruby/0167-two-sum-ii-input-array-is-sorted.rb similarity index 100% rename from ruby/167-Two-Sum-II.rb rename to ruby/0167-two-sum-ii-input-array-is-sorted.rb diff --git a/ruby/190-Reverse-Bits.rb b/ruby/0190-reverse-bits.rb similarity index 100% rename from ruby/190-Reverse-Bits.rb rename to ruby/0190-reverse-bits.rb diff --git a/ruby/191-Number-of-1-Bits.rb b/ruby/0191-number-of-1-bits.rb similarity index 100% rename from ruby/191-Number-of-1-Bits.rb rename to ruby/0191-number-of-1-bits.rb diff --git a/ruby/198-House-Robber.rb b/ruby/0198-house-robber.rb similarity index 100% rename from ruby/198-House-Robber.rb rename to ruby/0198-house-robber.rb diff --git a/ruby/200-Number-of-Islands.rb b/ruby/0200-number-of-islands.rb similarity index 100% rename from ruby/200-Number-of-Islands.rb rename to ruby/0200-number-of-islands.rb diff --git a/ruby/206-Reverse-Linked-List.rb b/ruby/0206-reverse-linked-list.rb similarity index 100% rename from ruby/206-Reverse-Linked-List.rb rename to ruby/0206-reverse-linked-list.rb diff --git a/ruby/208-Implement-Trie.rb b/ruby/0208-implement-trie-prefix-tree.rb similarity index 100% rename from ruby/208-Implement-Trie.rb rename to ruby/0208-implement-trie-prefix-tree.rb diff --git a/ruby/211-Design-Add-and-Search-Words-Data-Structure.rb b/ruby/0211-design-add-and-search-words-data-structure.rb similarity index 100% rename from ruby/211-Design-Add-and-Search-Words-Data-Structure.rb rename to ruby/0211-design-add-and-search-words-data-structure.rb diff --git a/ruby/213-House-Robber-II.rb b/ruby/0213-house-robber-ii.rb similarity index 100% rename from ruby/213-House-Robber-II.rb rename to ruby/0213-house-robber-ii.rb diff --git a/ruby/217-Contains-Duplicate.rb b/ruby/0217-contains-duplicate.rb similarity index 100% rename from ruby/217-Contains-Duplicate.rb rename to ruby/0217-contains-duplicate.rb diff --git a/ruby/226-Invert-Binary-Tree.rb b/ruby/0226-invert-binary-tree.rb similarity index 100% rename from ruby/226-Invert-Binary-Tree.rb rename to ruby/0226-invert-binary-tree.rb diff --git a/ruby/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.rb b/ruby/0235-lowest-common-ancestor-of-a-binary-search-tree.rb similarity index 100% rename from ruby/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.rb rename to ruby/0235-lowest-common-ancestor-of-a-binary-search-tree.rb diff --git a/ruby/238-Product-of-array-except-self.rb b/ruby/0238-product-of-array-except-self.rb similarity index 100% rename from ruby/238-Product-of-array-except-self.rb rename to ruby/0238-product-of-array-except-self.rb diff --git a/ruby/242-Valid-Anagrams.rb b/ruby/0242-valid-anagram.rb similarity index 100% rename from ruby/242-Valid-Anagrams.rb rename to ruby/0242-valid-anagram.rb diff --git a/ruby/268-Missing-Number.rb b/ruby/0268-missing-number.rb similarity index 100% rename from ruby/268-Missing-Number.rb rename to ruby/0268-missing-number.rb diff --git a/ruby/271-Encode-and-Decode-Strings.rb b/ruby/0271-encode-and-decode-strings.rb similarity index 100% rename from ruby/271-Encode-and-Decode-Strings.rb rename to ruby/0271-encode-and-decode-strings.rb diff --git a/ruby/287-Find-The-Duplicate-Number.rb b/ruby/0287-find-the-duplicate-number.rb similarity index 100% rename from ruby/287-Find-The-Duplicate-Number.rb rename to ruby/0287-find-the-duplicate-number.rb diff --git a/ruby/338-Counting-Bits.rb b/ruby/0338-counting-bits.rb similarity index 100% rename from ruby/338-Counting-Bits.rb rename to ruby/0338-counting-bits.rb diff --git a/ruby/347-Top-k-frequent-elements.rb b/ruby/0347-top-k-frequent-elements.rb similarity index 100% rename from ruby/347-Top-k-frequent-elements.rb rename to ruby/0347-top-k-frequent-elements.rb diff --git a/ruby/371-Sum-of-Two-Integers.rb b/ruby/0371-sum-of-two-integers.rb similarity index 100% rename from ruby/371-Sum-of-Two-Integers.rb rename to ruby/0371-sum-of-two-integers.rb diff --git a/ruby/424-Longest-Repeating-Character-Replacement.rb b/ruby/0424-longest-repeating-character-replacement.rb similarity index 100% rename from ruby/424-Longest-Repeating-Character-Replacement.rb rename to ruby/0424-longest-repeating-character-replacement.rb diff --git a/ruby/543-Diameter-of-Binary-Tree.rb b/ruby/0543-diameter-of-binary-tree.rb similarity index 100% rename from ruby/543-Diameter-of-Binary-Tree.rb rename to ruby/0543-diameter-of-binary-tree.rb diff --git a/ruby/572-Subtree-of-Another-Tree.rb b/ruby/0572-subtree-of-another-tree.rb similarity index 100% rename from ruby/572-Subtree-of-Another-Tree.rb rename to ruby/0572-subtree-of-another-tree.rb diff --git a/ruby/703-Kth-Largest-Element-in-a-Stream.rb b/ruby/0703-kth-largest-element-in-a-stream.rb similarity index 100% rename from ruby/703-Kth-Largest-Element-in-a-Stream.rb rename to ruby/0703-kth-largest-element-in-a-stream.rb diff --git a/ruby/704-Binary-Search.rb b/ruby/0704-binary-search.rb similarity index 100% rename from ruby/704-Binary-Search.rb rename to ruby/0704-binary-search.rb diff --git a/ruby/739-Daily-Temperatures.rb b/ruby/0739-daily-temperatures.rb similarity index 100% rename from ruby/739-Daily-Temperatures.rb rename to ruby/0739-daily-temperatures.rb diff --git a/ruby/746-Min-Cost-Climbing-Stairs.rb b/ruby/0746-min-cost-climbing-stairs.rb similarity index 100% rename from ruby/746-Min-Cost-Climbing-Stairs.rb rename to ruby/0746-min-cost-climbing-stairs.rb diff --git a/ruby/853-Car-Fleet.rb b/ruby/0853-car-fleet.rb similarity index 100% rename from ruby/853-Car-Fleet.rb rename to ruby/0853-car-fleet.rb diff --git a/ruby/875-Koko-Eating-Bananas.rb b/ruby/0875-koko-eating-bananas.rb similarity index 100% rename from ruby/875-Koko-Eating-Bananas.rb rename to ruby/0875-koko-eating-bananas.rb diff --git a/ruby/0981-time-based-key-value-store.rb b/ruby/0981-time-based-key-value-store.rb new file mode 100644 index 000000000..85da401db --- /dev/null +++ b/ruby/0981-time-based-key-value-store.rb @@ -0,0 +1,54 @@ +class TimeMap + def initialize() + @map = {} + end + + +=begin + :type key: String + :type value: String + :type timestamp: Integer + :rtype: Void +=end + def set(key, value, timestamp) + @map[key] = [] unless @map.key?(key) + + @map[key] << { v: value, t: timestamp } + end + + +=begin + :type key: String + :type timestamp: Integer + :rtype: String +=end + def get(key, timestamp) + return "" unless @map.key?(key) + + entries = @map[key] + return "" if timestamp < entries[0][:t] + return entries[-1][:v] if timestamp >= entries[-1][:t] + + l = 0 + r = entries.length - 1 + max = entries[0] + while l <= r + mid = ( l + r ) / 2 + curr = entries[mid] + + if curr[:t] < timestamp + max = curr + l = mid + 1 + else + r = mid - 1 + end + end + + max[:v] + end +end + +# Your TimeMap object will be instantiated and called as such: +# obj = TimeMap.new() +# obj.set(key, value, timestamp) +# param_2 = obj.get(key, timestamp) diff --git a/ruby/1046-last-stone-weight.rb b/ruby/1046-last-stone-weight.rb new file mode 100644 index 000000000..0e243f4d9 --- /dev/null +++ b/ruby/1046-last-stone-weight.rb @@ -0,0 +1,15 @@ +require "rubygems" +require "algorithms" +include Containers + +def last_stone_weight(stones) + heap = MaxHeap.new + stones.each { |stone| heap << stone } + until heap.size <= 1 + stone1 = heap.pop + stone2 = heap.pop + heap << (stone1 - stone2).abs if stone1 != stone2 + end + last = heap.pop + last.nil? ? 0 : last +end diff --git a/ruby/1584-min-cost-to-connect-all-points.rb b/ruby/1584-min-cost-to-connect-all-points.rb new file mode 100644 index 000000000..d0300b80c --- /dev/null +++ b/ruby/1584-min-cost-to-connect-all-points.rb @@ -0,0 +1,33 @@ +# @param {Integer[][]} points +# @return {Integer} +def min_cost_connect_points(points) + manhattan = ->(x, y) { (x[0] - y[0]).abs + (x[1] - y[1]).abs } + + to_visit = Set.new(points) + + result = 0 + bil = 1_000_000_000 + cost_to = Hash.new { bil } + + current_point = points[0] + to_visit.delete current_point + + (points.size - 1).times do |_i| + min = bil + next_point = nil + + to_visit.each do |point| + cost_to[point] = [cost_to[point], manhattan.call(current_point, point)].min + if min > cost_to[point] + min = cost_to[point] + next_point = point + end + end + + current_point = next_point + result += min + to_visit.delete current_point + end + + result +end diff --git a/rust/1-Two-Sum.rs b/rust/0001-two-sum.rs similarity index 100% rename from rust/1-Two-Sum.rs rename to rust/0001-two-sum.rs diff --git a/rust/3-Longest-Substring-Without-Repeating-Characters.rs b/rust/0003-longest-substring-without-repeating-characters.rs similarity index 100% rename from rust/3-Longest-Substring-Without-Repeating-Characters.rs rename to rust/0003-longest-substring-without-repeating-characters.rs diff --git a/rust/5-Longest-Palindromic-Substring.rs b/rust/0005-longest-palindromic-substring.rs similarity index 100% rename from rust/5-Longest-Palindromic-Substring.rs rename to rust/0005-longest-palindromic-substring.rs diff --git a/rust/11-Container-With-Most-Water.rs b/rust/0011-container-with-most-water.rs similarity index 100% rename from rust/11-Container-With-Most-Water.rs rename to rust/0011-container-with-most-water.rs diff --git a/rust/15-3sum.rs b/rust/0015-3sum.rs similarity index 100% rename from rust/15-3sum.rs rename to rust/0015-3sum.rs diff --git a/rust/20-Valid-Parentheses.rs b/rust/0020-valid-parentheses.rs similarity index 100% rename from rust/20-Valid-Parentheses.rs rename to rust/0020-valid-parentheses.rs diff --git a/rust/33-Search-In-Rotated-Sorted-Array.rs b/rust/0033-search-in-rotated-sorted-array.rs similarity index 100% rename from rust/33-Search-In-Rotated-Sorted-Array.rs rename to rust/0033-search-in-rotated-sorted-array.rs diff --git a/rust/36-Valid-Sudoku.rs b/rust/0036-valid-sudoku.rs similarity index 100% rename from rust/36-Valid-Sudoku.rs rename to rust/0036-valid-sudoku.rs diff --git a/rust/49-Group-Anagrams.rs b/rust/0049-group-anagrams.rs similarity index 100% rename from rust/49-Group-Anagrams.rs rename to rust/0049-group-anagrams.rs diff --git a/rust/53-Maximum-Subarray.rs b/rust/0053-maximum-subarray.rs similarity index 100% rename from rust/53-Maximum-Subarray.rs rename to rust/0053-maximum-subarray.rs diff --git a/rust/55-Jump-Game.rs b/rust/0055-jump-game.rs similarity index 100% rename from rust/55-Jump-Game.rs rename to rust/0055-jump-game.rs diff --git a/rust/57-Insert-Interval.rs b/rust/0057-insert-interval.rs similarity index 100% rename from rust/57-Insert-Interval.rs rename to rust/0057-insert-interval.rs diff --git a/rust/58-Length-of-Last-Word.rs b/rust/0058-length-of-last-word.rs similarity index 100% rename from rust/58-Length-of-Last-Word.rs rename to rust/0058-length-of-last-word.rs diff --git a/rust/62-Unique-Paths.rs b/rust/0062-unique-paths.rs similarity index 100% rename from rust/62-Unique-Paths.rs rename to rust/0062-unique-paths.rs diff --git a/rust/70-Climbing-Stairs.rs b/rust/0070-climbing-stairs.rs similarity index 100% rename from rust/70-Climbing-Stairs.rs rename to rust/0070-climbing-stairs.rs diff --git a/rust/76-Minimum-Window-Substring.rs b/rust/0076-minimum-window-substring.rs similarity index 100% rename from rust/76-Minimum-Window-Substring.rs rename to rust/0076-minimum-window-substring.rs diff --git a/rust/84-Largest-Rectangle-In-Histogram.rs b/rust/0084-largest-rectangle-in-histogram.rs similarity index 100% rename from rust/84-Largest-Rectangle-In-Histogram.rs rename to rust/0084-largest-rectangle-in-histogram.rs diff --git a/rust/118-Pascals-Triangle.rs b/rust/0118-pascals-triangle.rs similarity index 100% rename from rust/118-Pascals-Triangle.rs rename to rust/0118-pascals-triangle.rs diff --git a/rust/121-Best-Time-To-Buy.rs b/rust/0121-best-time-to-buy-and-sell-stock.rs similarity index 100% rename from rust/121-Best-Time-To-Buy.rs rename to rust/0121-best-time-to-buy-and-sell-stock.rs diff --git a/rust/125-Valid-Palindrome.rs b/rust/0125-valid-palindrome.rs similarity index 100% rename from rust/125-Valid-Palindrome.rs rename to rust/0125-valid-palindrome.rs diff --git a/rust/128-Longest-Consecutive-Sequence.rs b/rust/0128-longest-consecutive-sequence.rs similarity index 100% rename from rust/128-Longest-Consecutive-Sequence.rs rename to rust/0128-longest-consecutive-sequence.rs diff --git a/rust/152-Maximum-Product-Subarray.rs b/rust/0152-maximum-product-subarray.rs similarity index 100% rename from rust/152-Maximum-Product-Subarray.rs rename to rust/0152-maximum-product-subarray.rs diff --git a/rust/153-Find-Minimum-In-Rotated-Sorted-Array.rs b/rust/0153-find-minimum-in-rotated-sorted-array.rs similarity index 100% rename from rust/153-Find-Minimum-In-Rotated-Sorted-Array.rs rename to rust/0153-find-minimum-in-rotated-sorted-array.rs diff --git a/rust/167-Two-Sum-II.rs b/rust/0167-two-sum-ii-input-array-is-sorted.rs similarity index 100% rename from rust/167-Two-Sum-II.rs rename to rust/0167-two-sum-ii-input-array-is-sorted.rs diff --git a/rust/190-Reverse-Bits.rs b/rust/0190-reverse-bits.rs similarity index 100% rename from rust/190-Reverse-Bits.rs rename to rust/0190-reverse-bits.rs diff --git a/rust/191-Number-Of-1-Bits.rs b/rust/0191-number-of-1-bits.rs similarity index 100% rename from rust/191-Number-Of-1-Bits.rs rename to rust/0191-number-of-1-bits.rs diff --git a/rust/198-House-Robber.rs b/rust/0198-house-robber.rs similarity index 100% rename from rust/198-House-Robber.rs rename to rust/0198-house-robber.rs diff --git a/rust/208-Implement-Trie.rs b/rust/0208-implement-trie-prefix-tree.rs similarity index 100% rename from rust/208-Implement-Trie.rs rename to rust/0208-implement-trie-prefix-tree.rs diff --git a/rust/211-Design-Add-And-Search-Words-Data-Structure.rs b/rust/0211-design-add-and-search-words-data-structure.rs similarity index 100% rename from rust/211-Design-Add-And-Search-Words-Data-Structure.rs rename to rust/0211-design-add-and-search-words-data-structure.rs diff --git a/rust/212-Word-Search-II.rs b/rust/0212-word-search-ii.rs similarity index 100% rename from rust/212-Word-Search-II.rs rename to rust/0212-word-search-ii.rs diff --git a/rust/213-House-Robber-II.rs b/rust/0213-house-robber-ii.rs similarity index 100% rename from rust/213-House-Robber-II.rs rename to rust/0213-house-robber-ii.rs diff --git a/rust/217-Contains-Duplicates.rs b/rust/0217-contains-duplicate.rs similarity index 100% rename from rust/217-Contains-Duplicates.rs rename to rust/0217-contains-duplicate.rs diff --git a/rust/238-Product-Of-Array-Except-Self.rs b/rust/0238-product-of-array-except-self.rs similarity index 100% rename from rust/238-Product-Of-Array-Except-Self.rs rename to rust/0238-product-of-array-except-self.rs diff --git a/rust/242-Valid-Anagram.rs b/rust/0242-valid-anagram.rs similarity index 100% rename from rust/242-Valid-Anagram.rs rename to rust/0242-valid-anagram.rs diff --git a/rust/253-Meeting-Rooms.rs b/rust/0253-meeting-rooms.rs similarity index 100% rename from rust/253-Meeting-Rooms.rs rename to rust/0253-meeting-rooms.rs diff --git a/rust/268-Missing-Number.rs b/rust/0268-missing-number.rs similarity index 100% rename from rust/268-Missing-Number.rs rename to rust/0268-missing-number.rs diff --git a/rust/271-Encode-And-Decode-Strings.rs b/rust/0271-encode-and-decode-strings.rs similarity index 100% rename from rust/271-Encode-And-Decode-Strings.rs rename to rust/0271-encode-and-decode-strings.rs diff --git a/rust/322-Coin-Change.rs b/rust/0322-coin-change.rs similarity index 100% rename from rust/322-Coin-Change.rs rename to rust/0322-coin-change.rs diff --git a/rust/338-Counting-Bits.rs b/rust/0338-counting-bits.rs similarity index 100% rename from rust/338-Counting-Bits.rs rename to rust/0338-counting-bits.rs diff --git a/rust/347-Top-K-Frequent-Elements.rs b/rust/0347-top-k-frequent-elements.rs similarity index 100% rename from rust/347-Top-K-Frequent-Elements.rs rename to rust/0347-top-k-frequent-elements.rs diff --git a/rust/371-Sum-of-Two-Integers.rs b/rust/0371-sum-of-two-integers.rs similarity index 100% rename from rust/371-Sum-of-Two-Integers.rs rename to rust/0371-sum-of-two-integers.rs diff --git a/rust/392-Is-Subsequence.rs b/rust/0392-is-subsequence.rs similarity index 100% rename from rust/392-Is-Subsequence.rs rename to rust/0392-is-subsequence.rs diff --git a/rust/424-Longest-Repeating-Character-Replacement.rs b/rust/0424-longest-repeating-character-replacement.rs similarity index 100% rename from rust/424-Longest-Repeating-Character-Replacement.rs rename to rust/0424-longest-repeating-character-replacement.rs diff --git a/rust/647-Palindromic-Substrings.rs b/rust/0647-palindromic-substrings.rs similarity index 100% rename from rust/647-Palindromic-Substrings.rs rename to rust/0647-palindromic-substrings.rs diff --git a/rust/746-Min-Cost-Climbing-Stairs.rs b/rust/0746-min-cost-climbing-stairs.rs similarity index 100% rename from rust/746-Min-Cost-Climbing-Stairs.rs rename to rust/0746-min-cost-climbing-stairs.rs diff --git a/rust/1143-longest-common-subsequence.rs b/rust/1143-longest-common-subsequence.rs new file mode 100644 index 000000000..0db081ae3 --- /dev/null +++ b/rust/1143-longest-common-subsequence.rs @@ -0,0 +1,18 @@ +pub fn longest_common_subsequence(text1: String, text2: String) -> i32 { + let (text1, text2) = (text1.as_bytes(), text2.as_bytes()); + let (l1, l2) = (text1.len(), text2.len()); + + let mut matrix = vec![vec![0; l2 + 1]; l1 + 1]; + + for i in (0..l1).rev() { + for j in (0..l2).rev() { + matrix[i][j] = if text1[i] == text2[j] { + 1 + matrix[i + 1][j + 1] + } else { + matrix[i][j + 1].max(matrix[i + 1][j]) + }; + } + } + + matrix[0][0] +} diff --git a/rust/1299-replace-elements-with-greatest-element-on-right-side.rs b/rust/1299-replace-elements-with-greatest-element-on-right-side.rs new file mode 100644 index 000000000..5caf419ad --- /dev/null +++ b/rust/1299-replace-elements-with-greatest-element-on-right-side.rs @@ -0,0 +1,12 @@ +use std::cmp::max; + +impl Solution { + pub fn replace_elements(arr: Vec) -> Vec { + let length = arr.len(); + let mut ans: Vec = vec![-1; length]; + for i in (1..=(length - 1)).rev() { + ans[i - 1] = max(arr[i], ans[i]); + } + ans + } +} diff --git a/scala/1-Two-Sum.scala b/scala/0001-two-sum.scala similarity index 100% rename from scala/1-Two-Sum.scala rename to scala/0001-two-sum.scala diff --git a/scala/2-Add-Two-Numbers.scala b/scala/0002-add-two-numbers.scala similarity index 100% rename from scala/2-Add-Two-Numbers.scala rename to scala/0002-add-two-numbers.scala diff --git a/scala/3-Longest-Substring-Without-Repeating-Characters.scala b/scala/0003-longest-substring-without-repeating-characters.scala similarity index 100% rename from scala/3-Longest-Substring-Without-Repeating-Characters.scala rename to scala/0003-longest-substring-without-repeating-characters.scala diff --git a/scala/7-Reverse-Integer.scala b/scala/0007-reverse-integer.scala similarity index 100% rename from scala/7-Reverse-Integer.scala rename to scala/0007-reverse-integer.scala diff --git a/scala/15-3Sum.scala b/scala/0015-3sum.scala similarity index 100% rename from scala/15-3Sum.scala rename to scala/0015-3sum.scala diff --git a/scala/21-Merge-Two-Sorted-Lists.scala b/scala/0021-merge-two-sorted-lists.scala similarity index 100% rename from scala/21-Merge-Two-Sorted-Lists.scala rename to scala/0021-merge-two-sorted-lists.scala diff --git a/scala/33-Search-in-Rotated-Sorted-Array.scala b/scala/0033-search-in-rotated-sorted-array.scala similarity index 100% rename from scala/33-Search-in-Rotated-Sorted-Array.scala rename to scala/0033-search-in-rotated-sorted-array.scala diff --git a/scala/56-Merge-Intervals.scala b/scala/0056-merge-intervals.scala similarity index 100% rename from scala/56-Merge-Intervals.scala rename to scala/0056-merge-intervals.scala diff --git a/scala/91-Decode-Ways.scala b/scala/0091-decode-ways.scala similarity index 100% rename from scala/91-Decode-Ways.scala rename to scala/0091-decode-ways.scala diff --git a/scala/141-Linked-List-Cycle.scala b/scala/0141-linked-list-cycle.scala similarity index 100% rename from scala/141-Linked-List-Cycle.scala rename to scala/0141-linked-list-cycle.scala diff --git a/scala/153-Find-Minimum-In-Rotated-Sorted-Array.scala b/scala/0153-find-minimum-in-rotated-sorted-array.scala similarity index 100% rename from scala/153-Find-Minimum-In-Rotated-Sorted-Array.scala rename to scala/0153-find-minimum-in-rotated-sorted-array.scala diff --git a/scala/198-House-Robber.scala b/scala/0198-house-robber.scala similarity index 100% rename from scala/198-House-Robber.scala rename to scala/0198-house-robber.scala diff --git a/scala/206-Reverse-Linked-List.scala b/scala/0206-reverse-linked-list.scala similarity index 100% rename from scala/206-Reverse-Linked-List.scala rename to scala/0206-reverse-linked-list.scala diff --git a/scala/213-House-Robber-II.scala b/scala/0213-house-robber-ii.scala similarity index 100% rename from scala/213-House-Robber-II.scala rename to scala/0213-house-robber-ii.scala diff --git a/scala/217-Contains-Duplicate.scala b/scala/0217-contains-duplicate.scala similarity index 100% rename from scala/217-Contains-Duplicate.scala rename to scala/0217-contains-duplicate.scala diff --git a/scala/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.scala b/scala/0235-lowest-common-ancestor-of-a-binary-search-tree.scala similarity index 100% rename from scala/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.scala rename to scala/0235-lowest-common-ancestor-of-a-binary-search-tree.scala diff --git a/scala/435-Non-Overlapping-Intervals.scala b/scala/0435-non-overlapping-intervals.scala similarity index 100% rename from scala/435-Non-Overlapping-Intervals.scala rename to scala/0435-non-overlapping-intervals.scala diff --git a/scala/572-Subtree-of-Another-Tree.scala b/scala/0572-subtree-of-another-tree.scala similarity index 100% rename from scala/572-Subtree-of-Another-Tree.scala rename to scala/0572-subtree-of-another-tree.scala diff --git a/swift/1-Two-Sum.swift b/swift/0001-two-sum.swift similarity index 100% rename from swift/1-Two-Sum.swift rename to swift/0001-two-sum.swift diff --git a/swift/2-Add-Two-Numbers.swift b/swift/0002-add-two-numbers.swift similarity index 100% rename from swift/2-Add-Two-Numbers.swift rename to swift/0002-add-two-numbers.swift diff --git a/swift/3-Longest-Substring-Without-Repeating-Characters.swift b/swift/0003-longest-substring-without-repeating-characters.swift similarity index 100% rename from swift/3-Longest-Substring-Without-Repeating-Characters.swift rename to swift/0003-longest-substring-without-repeating-characters.swift diff --git a/swift/7-Reverse-Integer.swift b/swift/0007-reverse-integer.swift similarity index 100% rename from swift/7-Reverse-Integer.swift rename to swift/0007-reverse-integer.swift diff --git a/swift/11-Container-With-Most-Water.swift b/swift/0011-container-with-most-water.swift similarity index 100% rename from swift/11-Container-With-Most-Water.swift rename to swift/0011-container-with-most-water.swift diff --git a/swift/15-3Sum.swift b/swift/0015-3sum.swift similarity index 100% rename from swift/15-3Sum.swift rename to swift/0015-3sum.swift diff --git a/swift/19-Remove-Nth-Node-From-End-of-List.swift b/swift/0019-remove-nth-node-from-end-of-list.swift similarity index 100% rename from swift/19-Remove-Nth-Node-From-End-of-List.swift rename to swift/0019-remove-nth-node-from-end-of-list.swift diff --git a/swift/20-Valid-Parentheses b/swift/0020-valid-parentheses.swift similarity index 100% rename from swift/20-Valid-Parentheses rename to swift/0020-valid-parentheses.swift diff --git a/swift/21-Merge-Two-Sorted-Lists.swift b/swift/0021-merge-two-sorted-lists.swift similarity index 100% rename from swift/21-Merge-Two-Sorted-Lists.swift rename to swift/0021-merge-two-sorted-lists.swift diff --git a/swift/33-Search-in-Rotated-Sorted-Array.swift b/swift/0033-search-in-rotated-sorted-array.swift similarity index 100% rename from swift/33-Search-in-Rotated-Sorted-Array.swift rename to swift/0033-search-in-rotated-sorted-array.swift diff --git a/swift/35-Valid-Sudoku.swift b/swift/0035-search-insert-position.swift similarity index 100% rename from swift/35-Valid-Sudoku.swift rename to swift/0035-search-insert-position.swift diff --git a/swift/42-Trapping-Rain-Water.swift b/swift/0042-trapping-rain-water.swift similarity index 100% rename from swift/42-Trapping-Rain-Water.swift rename to swift/0042-trapping-rain-water.swift diff --git a/swift/43-Multiply-Strings.swift b/swift/0043-multiply-strings.swift similarity index 100% rename from swift/43-Multiply-Strings.swift rename to swift/0043-multiply-strings.swift diff --git a/swift/45-Jump-Game-II.swift b/swift/0045-jump-game-ii.swift similarity index 100% rename from swift/45-Jump-Game-II.swift rename to swift/0045-jump-game-ii.swift diff --git a/swift/46-Permutations.swift b/swift/0046-permutations.swift similarity index 100% rename from swift/46-Permutations.swift rename to swift/0046-permutations.swift diff --git a/swift/48-Rotate-Image.swift b/swift/0048-rotate-image.swift similarity index 100% rename from swift/48-Rotate-Image.swift rename to swift/0048-rotate-image.swift diff --git a/swift/49-Group-Anagrams.swift b/swift/0049-group-anagrams.swift similarity index 100% rename from swift/49-Group-Anagrams.swift rename to swift/0049-group-anagrams.swift diff --git a/swift/50-Pow(x, n).swift b/swift/0050-powx-n.swift similarity index 100% rename from swift/50-Pow(x, n).swift rename to swift/0050-powx-n.swift diff --git a/swift/53-Maximum-Subarray.swift b/swift/0053-maximum-subarray.swift similarity index 100% rename from swift/53-Maximum-Subarray.swift rename to swift/0053-maximum-subarray.swift diff --git a/swift/55-Jump-Game.swift b/swift/0055-jump-game.swift similarity index 100% rename from swift/55-Jump-Game.swift rename to swift/0055-jump-game.swift diff --git a/swift/57-Insert-Interval.swift b/swift/0057-insert-interval.swift similarity index 100% rename from swift/57-Insert-Interval.swift rename to swift/0057-insert-interval.swift diff --git a/swift/66-Plus-One.swift b/swift/0066-plus-one.swift similarity index 100% rename from swift/66-Plus-One.swift rename to swift/0066-plus-one.swift diff --git a/swift/70-Climbing-Stairs.swift b/swift/0070-climbing-stairs.swift similarity index 100% rename from swift/70-Climbing-Stairs.swift rename to swift/0070-climbing-stairs.swift diff --git a/swift/72-Edit-Distance.swift b/swift/0072-edit-distance.swift similarity index 100% rename from swift/72-Edit-Distance.swift rename to swift/0072-edit-distance.swift diff --git a/swift/74-Search-A-2D-Matrix.swift b/swift/0074-search-a-2d-matrix.swift similarity index 100% rename from swift/74-Search-A-2D-Matrix.swift rename to swift/0074-search-a-2d-matrix.swift diff --git a/swift/78-Subsets.swift b/swift/0078-subsets.swift similarity index 100% rename from swift/78-Subsets.swift rename to swift/0078-subsets.swift diff --git a/swift/79-Word-Search.swift b/swift/0079-word-search.swift similarity index 100% rename from swift/79-Word-Search.swift rename to swift/0079-word-search.swift diff --git a/swift/98-Validate-Binary-Search-Tree.swift b/swift/0098-validate-binary-search-tree.swift similarity index 100% rename from swift/98-Validate-Binary-Search-Tree.swift rename to swift/0098-validate-binary-search-tree.swift diff --git a/swift/100-Same-Tree.swift b/swift/0100-same-tree.swift similarity index 100% rename from swift/100-Same-Tree.swift rename to swift/0100-same-tree.swift diff --git a/swift/102-Binary-Tree-Level-Order-Traversal.swift b/swift/0102-binary-tree-level-order-traversal.swift similarity index 100% rename from swift/102-Binary-Tree-Level-Order-Traversal.swift rename to swift/0102-binary-tree-level-order-traversal.swift diff --git a/swift/104-Maximum-Depth-of-Binary-Tree.swift b/swift/0104-maximum-depth-of-binary-tree.swift similarity index 100% rename from swift/104-Maximum-Depth-of-Binary-Tree.swift rename to swift/0104-maximum-depth-of-binary-tree.swift diff --git a/swift/110-Balanced-Binary-Tree.swift b/swift/0110-balanced-binary-tree.swift similarity index 100% rename from swift/110-Balanced-Binary-Tree.swift rename to swift/0110-balanced-binary-tree.swift diff --git a/swift/121-Best-Time-To-Buy-And-Sell-Stock.swift b/swift/0121-best-time-to-buy-and-sell-stock.swift similarity index 100% rename from swift/121-Best-Time-To-Buy-And-Sell-Stock.swift rename to swift/0121-best-time-to-buy-and-sell-stock.swift diff --git a/swift/124-Binary-Tree-Maximum-Path-Sum.swift b/swift/0124-binary-tree-maximum-path-sum.swift similarity index 100% rename from swift/124-Binary-Tree-Maximum-Path-Sum.swift rename to swift/0124-binary-tree-maximum-path-sum.swift diff --git a/swift/125-Valid-Palindrome.swift b/swift/0125-valid-palindrome.swift similarity index 100% rename from swift/125-Valid-Palindrome.swift rename to swift/0125-valid-palindrome.swift diff --git a/swift/128-Longest-Consecutive-Sequence.swift b/swift/0128-longest-consecutive-sequence.swift similarity index 100% rename from swift/128-Longest-Consecutive-Sequence.swift rename to swift/0128-longest-consecutive-sequence.swift diff --git a/swift/130-Surrounded-Regions.swift b/swift/0130-surrounded-regions.swift similarity index 100% rename from swift/130-Surrounded-Regions.swift rename to swift/0130-surrounded-regions.swift diff --git a/swift/133-Clone-Graph.swift b/swift/0133-clone-graph.swift similarity index 100% rename from swift/133-Clone-Graph.swift rename to swift/0133-clone-graph.swift diff --git a/swift/134-Gas-Station.swift b/swift/0134-gas-station.swift similarity index 100% rename from swift/134-Gas-Station.swift rename to swift/0134-gas-station.swift diff --git a/swift/136-Single-Number.swift b/swift/0136-single-number.swift similarity index 100% rename from swift/136-Single-Number.swift rename to swift/0136-single-number.swift diff --git a/swift/138-Copy-List-with-Random-Pointer.swift b/swift/0138-copy-list-with-random-pointer.swift similarity index 100% rename from swift/138-Copy-List-with-Random-Pointer.swift rename to swift/0138-copy-list-with-random-pointer.swift diff --git a/swift/141-Linked-List-Cycle.swift b/swift/0141-linked-list-cycle.swift similarity index 100% rename from swift/141-Linked-List-Cycle.swift rename to swift/0141-linked-list-cycle.swift diff --git a/swift/150-Evaluate-Reverse-Polish-Notation.swift b/swift/0150-evaluate-reverse-polish-notation.swift similarity index 100% rename from swift/150-Evaluate-Reverse-Polish-Notation.swift rename to swift/0150-evaluate-reverse-polish-notation.swift diff --git a/swift/152-Maximum-Product-Subarray.swift b/swift/0152-maximum-product-subarray.swift similarity index 100% rename from swift/152-Maximum-Product-Subarray.swift rename to swift/0152-maximum-product-subarray.swift diff --git a/swift/153-Find-Minimum-in-Rotated-Sorted-Array.swift b/swift/0153-find-minimum-in-rotated-sorted-array.swift similarity index 100% rename from swift/153-Find-Minimum-in-Rotated-Sorted-Array.swift rename to swift/0153-find-minimum-in-rotated-sorted-array.swift diff --git a/swift/167-Two-Sum-II-Input-Array-Is-Sorted.swift b/swift/0167-two-sum-ii-input-array-is-sorted.swift similarity index 100% rename from swift/167-Two-Sum-II-Input-Array-Is-Sorted.swift rename to swift/0167-two-sum-ii-input-array-is-sorted.swift diff --git a/swift/169-Majority-Element.swift b/swift/0169-majority-element.swift similarity index 100% rename from swift/169-Majority-Element.swift rename to swift/0169-majority-element.swift diff --git a/swift/190-Reverse-Bits.swift b/swift/0190-reverse-bits.swift similarity index 100% rename from swift/190-Reverse-Bits.swift rename to swift/0190-reverse-bits.swift diff --git a/swift/191-Number-of-1-Bits.swift b/swift/0191-number-of-1-bits.swift similarity index 100% rename from swift/191-Number-of-1-Bits.swift rename to swift/0191-number-of-1-bits.swift diff --git a/swift/198-House-Robber.swift b/swift/0198-house-robber.swift similarity index 100% rename from swift/198-House-Robber.swift rename to swift/0198-house-robber.swift diff --git a/swift/199-Binary-Tree-Right-Side-View.swift b/swift/0199-binary-tree-right-side-view.swift similarity index 100% rename from swift/199-Binary-Tree-Right-Side-View.swift rename to swift/0199-binary-tree-right-side-view.swift diff --git a/swift/200-Number-of-Islands.swift b/swift/0200-number-of-islands.swift similarity index 100% rename from swift/200-Number-of-Islands.swift rename to swift/0200-number-of-islands.swift diff --git a/swift/202-Happy-Number.swift b/swift/0202-happy-number.swift similarity index 100% rename from swift/202-Happy-Number.swift rename to swift/0202-happy-number.swift diff --git a/swift/205-Isomorphic-Strings.swift b/swift/0205-isomorphic-strings.swift similarity index 100% rename from swift/205-Isomorphic-Strings.swift rename to swift/0205-isomorphic-strings.swift diff --git a/swift/206-Reverse-Linked-List.swift b/swift/0206-reverse-linked-list.swift similarity index 100% rename from swift/206-Reverse-Linked-List.swift rename to swift/0206-reverse-linked-list.swift diff --git a/swift/207-Course-Schedule.swift b/swift/0207-course-schedule.swift similarity index 100% rename from swift/207-Course-Schedule.swift rename to swift/0207-course-schedule.swift diff --git a/swift/208-Implement-Trie-(Prefix-Tree).swift b/swift/0208-implement-trie-prefix-tree.swift similarity index 100% rename from swift/208-Implement-Trie-(Prefix-Tree).swift rename to swift/0208-implement-trie-prefix-tree.swift diff --git a/swift/212-Word-Search-II.swift b/swift/0212-word-search-ii.swift similarity index 100% rename from swift/212-Word-Search-II.swift rename to swift/0212-word-search-ii.swift diff --git a/swift/213-House-Robber-II.swift b/swift/0213-house-robber-ii.swift similarity index 100% rename from swift/213-House-Robber-II.swift rename to swift/0213-house-robber-ii.swift diff --git a/swift/217-Contains-Duplicate.swift b/swift/0217-contains-duplicate.swift similarity index 100% rename from swift/217-Contains-Duplicate.swift rename to swift/0217-contains-duplicate.swift diff --git a/swift/226-Invert-Binary-Tree b/swift/0226-invert-binary-tree.swift similarity index 100% rename from swift/226-Invert-Binary-Tree rename to swift/0226-invert-binary-tree.swift diff --git a/swift/230-Kth-Smallest-Element-In-A-BST.swift b/swift/0230-kth-smallest-element-in-a-bst.swift similarity index 100% rename from swift/230-Kth-Smallest-Element-In-A-BST.swift rename to swift/0230-kth-smallest-element-in-a-bst.swift diff --git a/swift/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.swift b/swift/0235-lowest-common-ancestor-of-a-binary-search-tree.swift similarity index 100% rename from swift/235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.swift rename to swift/0235-lowest-common-ancestor-of-a-binary-search-tree.swift diff --git a/swift/238-Product-of-array-except-self.swift b/swift/0238-product-of-array-except-self.swift similarity index 100% rename from swift/238-Product-of-array-except-self.swift rename to swift/0238-product-of-array-except-self.swift diff --git a/swift/242-Valid-Anagram.swift b/swift/0242-valid-anagram.swift similarity index 100% rename from swift/242-Valid-Anagram.swift rename to swift/0242-valid-anagram.swift diff --git a/swift/261-Graph-Valid-Tree.swift b/swift/0261-graph-valid-tree.swift similarity index 100% rename from swift/261-Graph-Valid-Tree.swift rename to swift/0261-graph-valid-tree.swift diff --git a/swift/268-Missing-Number.swift b/swift/0268-missing-number.swift similarity index 100% rename from swift/268-Missing-Number.swift rename to swift/0268-missing-number.swift diff --git a/swift/271-Encode-and-Decode-Strings.swift b/swift/0271-encode-and-decode-strings.swift similarity index 100% rename from swift/271-Encode-and-Decode-Strings.swift rename to swift/0271-encode-and-decode-strings.swift diff --git a/swift/287-Find-The-Duplicate-Number.swift b/swift/0287-find-the-duplicate-number.swift similarity index 100% rename from swift/287-Find-The-Duplicate-Number.swift rename to swift/0287-find-the-duplicate-number.swift diff --git a/swift/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.swift b/swift/0309-best-time-to-buy-and-sell-stock-with-cooldown.swift similarity index 100% rename from swift/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.swift rename to swift/0309-best-time-to-buy-and-sell-stock-with-cooldown.swift diff --git a/swift/323-Number-of-Connected-Components-in-an-Undirected-Graph.swift b/swift/0323-number-of-connected-components-in-an-undirected-graph.swift similarity index 100% rename from swift/323-Number-of-Connected-Components-in-an-Undirected-Graph.swift rename to swift/0323-number-of-connected-components-in-an-undirected-graph.swift diff --git a/swift/338-Counting-Bits.swift b/swift/0338-counting-bits.swift similarity index 100% rename from swift/338-Counting-Bits.swift rename to swift/0338-counting-bits.swift diff --git a/swift/344-Reverse-String.swift b/swift/0344-reverse-string.swift similarity index 100% rename from swift/344-Reverse-String.swift rename to swift/0344-reverse-string.swift diff --git a/swift/347-Top-k-frequent-elements.swift b/swift/0347-top-k-frequent-elements.swift similarity index 100% rename from swift/347-Top-k-frequent-elements.swift rename to swift/0347-top-k-frequent-elements.swift diff --git a/swift/371-Sum-Of-Two-Integers.swift b/swift/0371-sum-of-two-integers.swift similarity index 100% rename from swift/371-Sum-Of-Two-Integers.swift rename to swift/0371-sum-of-two-integers.swift diff --git a/swift/543-Diameter-of-Binary-Tree.swift b/swift/0543-diameter-of-binary-tree.swift similarity index 100% rename from swift/543-Diameter-of-Binary-Tree.swift rename to swift/0543-diameter-of-binary-tree.swift diff --git a/swift/572-Subtree-of-Another-Tree.swift b/swift/0572-subtree-of-another-tree.swift similarity index 100% rename from swift/572-Subtree-of-Another-Tree.swift rename to swift/0572-subtree-of-another-tree.swift diff --git a/swift/703-Kth-Largest-Element-In-A-Stream.swift b/swift/0703-kth-largest-element-in-a-stream.swift similarity index 100% rename from swift/703-Kth-Largest-Element-In-A-Stream.swift rename to swift/0703-kth-largest-element-in-a-stream.swift diff --git a/swift/704-Binary-Search b/swift/0704-binary-search.swift similarity index 100% rename from swift/704-Binary-Search rename to swift/0704-binary-search.swift diff --git a/swift/739-Daily-Temperatures.swift b/swift/0739-daily-temperatures.swift similarity index 100% rename from swift/739-Daily-Temperatures.swift rename to swift/0739-daily-temperatures.swift diff --git a/swift/746-Min-Cost-Climbing-Stairs.swift b/swift/0746-min-cost-climbing-stairs.swift similarity index 100% rename from swift/746-Min-Cost-Climbing-Stairs.swift rename to swift/0746-min-cost-climbing-stairs.swift diff --git a/swift/875-Koko-Eating-Bananas.swift b/swift/0875-koko-eating-bananas.swift similarity index 100% rename from swift/875-Koko-Eating-Bananas.swift rename to swift/0875-koko-eating-bananas.swift diff --git a/swift/929-Unique-Email-Addresses.swift b/swift/0929-unique-email-addresses.swift similarity index 100% rename from swift/929-Unique-Email-Addresses.swift rename to swift/0929-unique-email-addresses.swift diff --git a/swift/1143-longest-common-subsequence.swift b/swift/1143-longest-common-subsequence.swift new file mode 100644 index 000000000..9813cfd3c --- /dev/null +++ b/swift/1143-longest-common-subsequence.swift @@ -0,0 +1,21 @@ +class Solution { + func longestCommonSubsequence(_ text1: String, _ text2: String) -> Int { + + var dp = [[Int]](repeating: [Int](repeating: 0, count: text2.count + 1), count: text1.count + 1) + + let d1 = Array(text1) + let d2 = Array(text2) + + for i in stride(from: d1.count - 1, to: -1, by: -1) { + for j in stride(from: d2.count - 1, to: -1, by: -1) { + if d1[i] == d2[j] { + dp[i][j] = 1 + dp[i + 1][j + 1] + } else { + dp[i][j] = max(dp[i][j + 1], dp[i + 1][j]) + } + } + } + + return dp[0][0] + } +} diff --git a/swift/121-Best-Time-to-Buy-and-Sell-Stock.swift b/swift/121-Best-Time-to-Buy-and-Sell-Stock.swift deleted file mode 100644 index f66d27437..000000000 --- a/swift/121-Best-Time-to-Buy-and-Sell-Stock.swift +++ /dev/null @@ -1,16 +0,0 @@ -class Solution { - func maxProfit(_ prices: [Int]) -> Int { - var res = 0 - var l = 0 - var r = 0 - - for r in 1.. Int { - guard let root = root else { return 0 } - return helper(root, Int.min) - } - - func helper(_ root: TreeNode?, _ lastVal: Int) -> Int { - guard let root = root else { return 0 } - let i = root.val >= lastVal ? 1 : 0 - let left = helper(root.left, max(lastVal, root.val)) - let right = helper(root.right, max(lastVal, root.val)) - return i + left + right - } -} \ No newline at end of file diff --git a/swift/1448-Count-Good-Nodes-in-Binary-Tree-1.swift b/swift/1448-count-good-nodes-in-binary-tree.swift similarity index 100% rename from swift/1448-Count-Good-Nodes-in-Binary-Tree-1.swift rename to swift/1448-count-good-nodes-in-binary-tree.swift diff --git a/swift/1584-min-cost-to-connect-all-points.swift b/swift/1584-min-cost-to-connect-all-points.swift new file mode 100644 index 000000000..43d6fb811 --- /dev/null +++ b/swift/1584-min-cost-to-connect-all-points.swift @@ -0,0 +1,95 @@ +class DisjointSet { + var roots: [Int] + var ranks: [Int] + + init(n: Int) { + roots = [Int](repeating: 0, count: n) + ranks = [Int](repeating: 0, count: n) + + for i in 0.. Int { + guard u != roots[u] else { return u } + roots[u] = find(roots[u]) + return roots[u] + } + + public func union(_ x: Int, _ y: Int) { + let rootX = roots[x] + let rootY = roots[y] + guard rootX != rootY else { return } + + // assign to the bigger one + if ranks[rootX] > ranks[rootY] { + roots[rootY] = rootX + } else if ranks[rootY] > ranks[rootX] { + roots[rootX] = rootY + } else { + // default: assign to root X + roots[rootY] = rootX + ranks[rootX] += 1 + } + } + + public func areDisjoint(u: Int, v: Int) -> Bool { + find(u) != find(v) + } +} + +struct Edge { + let source: Int + let destination: Int + let weight: Int + + init(u: Int, v: Int, w: Int) { + source = u + destination = v + weight = w + } +} + +class Solution { + func minCostConnectPoints(_ points: [[Int]]) -> Int { + let edges: [Edge] = getEdges(from: points) + // images.sorted(by: { $0.fileID > $1.fileID }) + // sort by ascending order + let sortedEdges = edges.sorted { $0.weight < $1.weight } + var disjointSet = DisjointSet(n: points.count) + var total = 0 + + sortedEdges.forEach { edge in + let u = edge.source + let v = edge.destination + let w = edge.weight + + guard disjointSet.areDisjoint(u: u, v: v) else { return } + disjointSet.union(u, v) + total += w + } + + return total + } +} + +private extension Solution { + func distance(from point1: [Int], to point2: [Int]) -> Int { + abs(point1[0] - point2[0]) + abs(point1[1] - point2[1]) + } + + func getEdges(from points: [[Int]]) -> [Edge] { + var edges: [Edge] = [] + let n = points.count + for i in 0.. String { + // Use a Min Heap for storing upto k-elements max in the priority queue + var heap: Heap = Heap(sort: { (str1, str2) in + guard str1.count == str2.count else { return str1.count < str2.count } + for (c1, c2) in zip(str1, str2) { + guard c1 == c2 else { return c1 < c2 } + } + return false + }) + + nums.forEach { num in + heap.insert(num) + if heap.count > k { + heap.remove() + } + } + + return heap.peek() ?? "" + } +} + +// Heap used from https://github.com/kodecocodes/swift-algorithm-club/blob/master/Heap/Heap.swift +public struct Heap { + var nodes = [T]() + + private var orderCriteria: (T, T) -> Bool + + public init(sort: @escaping (T, T) -> Bool) { + self.orderCriteria = sort + } + + public init(array: [T], sort: @escaping (T, T) -> Bool) { + self.orderCriteria = sort + configureHeap(from: array) + } + + private mutating func configureHeap(from array: [T]) { + nodes = array + for i in stride(from: (nodes.count/2-1), through: 0, by: -1) { + shiftDown(i) + } + } + + public var isEmpty: Bool { + return nodes.isEmpty + } + + public var count: Int { + return nodes.count + } + + @inline(__always) internal func parentIndex(ofIndex i: Int) -> Int { + return (i - 1) / 2 + } + + @inline(__always) internal func leftChildIndex(ofIndex i: Int) -> Int { + return 2*i + 1 + } + + @inline(__always) internal func rightChildIndex(ofIndex i: Int) -> Int { + return 2*i + 2 + } + + public func peek() -> T? { + return nodes.first + } + + public mutating func insert(_ value: T) { + nodes.append(value) + shiftUp(nodes.count - 1) + } + + public mutating func insert(_ sequence: S) where S.Iterator.Element == T { + for value in sequence { + insert(value) + } + } + + public mutating func replace(index i: Int, value: T) { + guard i < nodes.count else { return } + remove(at: i) + insert(value) + } + + @discardableResult public mutating func remove() -> T? { + guard !nodes.isEmpty else { return nil } + if nodes.count == 1 { + return nodes.removeLast() + } else { + let value = nodes[0] + nodes[0] = nodes.removeLast() + shiftDown(0) + return value + } + } + + @discardableResult public mutating func remove(at index: Int) -> T? { + guard index < nodes.count else { return nil } + let size = nodes.count - 1 + if index != size { + nodes.swapAt(index, size) + shiftDown(from: index, until: size) + shiftUp(index) + } + return nodes.removeLast() + } + + internal mutating func shiftUp(_ index: Int) { + var childIndex = index + let child = nodes[childIndex] + var parentIndex = self.parentIndex(ofIndex: childIndex) + + while childIndex > 0 && orderCriteria(child, nodes[parentIndex]) { + nodes[childIndex] = nodes[parentIndex] + childIndex = parentIndex + parentIndex = self.parentIndex(ofIndex: childIndex) + } + + nodes[childIndex] = child + } + + internal mutating func shiftDown(from index: Int, until endIndex: Int) { + let leftChildIndex = self.leftChildIndex(ofIndex: index) + let rightChildIndex = leftChildIndex + 1 + + var first = index + if leftChildIndex < endIndex && orderCriteria(nodes[leftChildIndex], nodes[first]) { + first = leftChildIndex + } + if rightChildIndex < endIndex && orderCriteria(nodes[rightChildIndex], nodes[first]) { + first = rightChildIndex + } + if first == index { return } + + nodes.swapAt(index, first) + shiftDown(from: first, until: endIndex) + } + + internal mutating func shiftDown(_ index: Int) { + shiftDown(from: index, until: nodes.count) + } +} \ No newline at end of file diff --git a/typescript/1-Two-Sum.ts b/typescript/0001-two-sum.ts similarity index 100% rename from typescript/1-Two-Sum.ts rename to typescript/0001-two-sum.ts diff --git a/typescript/2-Add-Two-Numbers.ts b/typescript/0002-add-two-numbers.ts similarity index 100% rename from typescript/2-Add-Two-Numbers.ts rename to typescript/0002-add-two-numbers.ts diff --git a/typescript/3-Longest-Substring-Without-Repeating-Characters.ts b/typescript/0003-longest-substring-without-repeating-characters.ts similarity index 100% rename from typescript/3-Longest-Substring-Without-Repeating-Characters.ts rename to typescript/0003-longest-substring-without-repeating-characters.ts diff --git a/typescript/4-Median-of-Two-Sorted-Arrays.ts b/typescript/0004-median-of-two-sorted-arrays.ts similarity index 100% rename from typescript/4-Median-of-Two-Sorted-Arrays.ts rename to typescript/0004-median-of-two-sorted-arrays.ts diff --git a/typescript/5-Longest-Palindromic-Substring.ts b/typescript/0005-longest-palindromic-substring.ts similarity index 100% rename from typescript/5-Longest-Palindromic-Substring.ts rename to typescript/0005-longest-palindromic-substring.ts diff --git a/typescript/7-Reverse-Integer.ts b/typescript/0007-reverse-integer.ts similarity index 100% rename from typescript/7-Reverse-Integer.ts rename to typescript/0007-reverse-integer.ts diff --git a/typescript/9-Palindrome-Number.ts b/typescript/0009-palindrome-number.ts similarity index 100% rename from typescript/9-Palindrome-Number.ts rename to typescript/0009-palindrome-number.ts diff --git a/typescript/10-Regular-Expression-Matching.ts b/typescript/0010-regular-expression-matching.ts similarity index 100% rename from typescript/10-Regular-Expression-Matching.ts rename to typescript/0010-regular-expression-matching.ts diff --git a/typescript/11-Container-With-Most-Water.ts b/typescript/0011-container-with-most-water.ts similarity index 100% rename from typescript/11-Container-With-Most-Water.ts rename to typescript/0011-container-with-most-water.ts diff --git a/typescript/15-3Sum.ts b/typescript/0015-3sum.ts similarity index 100% rename from typescript/15-3Sum.ts rename to typescript/0015-3sum.ts diff --git a/typescript/17-Letter-Combinations-of-a-Phone-Number.ts b/typescript/0017-letter-combinations-of-a-phone-number.ts similarity index 100% rename from typescript/17-Letter-Combinations-of-a-Phone-Number.ts rename to typescript/0017-letter-combinations-of-a-phone-number.ts diff --git a/typescript/19-Remove-Nth-Node-From-End-of-List.ts b/typescript/0019-remove-nth-node-from-end-of-list.ts similarity index 100% rename from typescript/19-Remove-Nth-Node-From-End-of-List.ts rename to typescript/0019-remove-nth-node-from-end-of-list.ts diff --git a/typescript/20-Valid-Parentheses.ts b/typescript/0020-valid-parentheses.ts similarity index 100% rename from typescript/20-Valid-Parentheses.ts rename to typescript/0020-valid-parentheses.ts diff --git a/typescript/21-Merge-Two-Sorted-Lists.ts b/typescript/0021-merge-two-sorted-lists.ts similarity index 100% rename from typescript/21-Merge-Two-Sorted-Lists.ts rename to typescript/0021-merge-two-sorted-lists.ts diff --git a/typescript/22-Generate-Parentheses.ts b/typescript/0022-generate-parentheses.ts similarity index 100% rename from typescript/22-Generate-Parentheses.ts rename to typescript/0022-generate-parentheses.ts diff --git a/typescript/23-Merge-k-Sorted-Lists.ts b/typescript/0023-merge-k-sorted-lists.ts similarity index 100% rename from typescript/23-Merge-k-Sorted-Lists.ts rename to typescript/0023-merge-k-sorted-lists.ts diff --git a/typescript/25-Reverse-Nodes-in-k-Group.ts b/typescript/0025-reverse-nodes-in-k-group.ts similarity index 100% rename from typescript/25-Reverse-Nodes-in-k-Group.ts rename to typescript/0025-reverse-nodes-in-k-group.ts diff --git a/typescript/27-Remove-Element.ts b/typescript/0027-remove-element.ts similarity index 100% rename from typescript/27-Remove-Element.ts rename to typescript/0027-remove-element.ts diff --git a/typescript/33-Search-in-Rotated-Sorted-Array.ts b/typescript/0033-search-in-rotated-sorted-array.ts similarity index 100% rename from typescript/33-Search-in-Rotated-Sorted-Array.ts rename to typescript/0033-search-in-rotated-sorted-array.ts diff --git a/typescript/36-Valid-Sudoku.ts b/typescript/0036-valid-sudoku.ts similarity index 100% rename from typescript/36-Valid-Sudoku.ts rename to typescript/0036-valid-sudoku.ts diff --git a/typescript/39-Combination-Sum.ts b/typescript/0039-combination-sum.ts similarity index 100% rename from typescript/39-Combination-Sum.ts rename to typescript/0039-combination-sum.ts diff --git a/typescript/40-Combination-Sum-II.ts b/typescript/0040-combination-sum-ii.ts similarity index 100% rename from typescript/40-Combination-Sum-II.ts rename to typescript/0040-combination-sum-ii.ts diff --git a/typescript/41-First-Missing-Positive.ts b/typescript/0041-first-missing-positive.ts similarity index 100% rename from typescript/41-First-Missing-Positive.ts rename to typescript/0041-first-missing-positive.ts diff --git a/typescript/42-Trapping-Rain-Water.ts b/typescript/0042-trapping-rain-water.ts similarity index 100% rename from typescript/42-Trapping-Rain-Water.ts rename to typescript/0042-trapping-rain-water.ts diff --git a/typescript/43-Multiply-Strings.ts b/typescript/0043-multiply-strings.ts similarity index 100% rename from typescript/43-Multiply-Strings.ts rename to typescript/0043-multiply-strings.ts diff --git a/typescript/45-Jump-Game-II.ts b/typescript/0045-jump-game-ii.ts similarity index 100% rename from typescript/45-Jump-Game-II.ts rename to typescript/0045-jump-game-ii.ts diff --git a/typescript/46-Permutations.ts b/typescript/0046-permutations.ts similarity index 100% rename from typescript/46-Permutations.ts rename to typescript/0046-permutations.ts diff --git a/typescript/48-Rotate-Image.ts b/typescript/0048-rotate-image.ts similarity index 100% rename from typescript/48-Rotate-Image.ts rename to typescript/0048-rotate-image.ts diff --git a/typescript/49-Group-Anagrams.ts b/typescript/0049-group-anagrams.ts similarity index 100% rename from typescript/49-Group-Anagrams.ts rename to typescript/0049-group-anagrams.ts diff --git a/typescript/50-Pow.ts b/typescript/0050-powx-n.ts similarity index 100% rename from typescript/50-Pow.ts rename to typescript/0050-powx-n.ts diff --git a/typescript/51-N-Queens b/typescript/0051-n-queens.ts similarity index 100% rename from typescript/51-N-Queens rename to typescript/0051-n-queens.ts diff --git a/typescript/53-Maximum-Subarray.ts b/typescript/0053-maximum-subarray.ts similarity index 100% rename from typescript/53-Maximum-Subarray.ts rename to typescript/0053-maximum-subarray.ts diff --git a/typescript/54-Spiral-Matrix.ts b/typescript/0054-spiral-matrix.ts similarity index 100% rename from typescript/54-Spiral-Matrix.ts rename to typescript/0054-spiral-matrix.ts diff --git a/typescript/55-Jump-Game.ts b/typescript/0055-jump-game.ts similarity index 100% rename from typescript/55-Jump-Game.ts rename to typescript/0055-jump-game.ts diff --git a/typescript/56-Merge-Intervals.ts b/typescript/0056-merge-intervals.ts similarity index 100% rename from typescript/56-Merge-Intervals.ts rename to typescript/0056-merge-intervals.ts diff --git a/typescript/57-Insert-Interval.ts b/typescript/0057-insert-interval.ts similarity index 100% rename from typescript/57-Insert-Interval.ts rename to typescript/0057-insert-interval.ts diff --git a/typescript/58-Length-Of-Last-Word.ts b/typescript/0058-length-of-last-word.ts similarity index 100% rename from typescript/58-Length-Of-Last-Word.ts rename to typescript/0058-length-of-last-word.ts diff --git a/typescript/62-Unique-Paths.ts b/typescript/0062-unique-paths.ts similarity index 100% rename from typescript/62-Unique-Paths.ts rename to typescript/0062-unique-paths.ts diff --git a/typescript/66-Plus-One.ts b/typescript/0066-plus-one.ts similarity index 100% rename from typescript/66-Plus-One.ts rename to typescript/0066-plus-one.ts diff --git a/typescript/70-Climbing-Stairs.ts b/typescript/0070-climbing-stairs.ts similarity index 100% rename from typescript/70-Climbing-Stairs.ts rename to typescript/0070-climbing-stairs.ts diff --git a/typescript/71-Simplify-Path.ts b/typescript/0071-simplify-path.ts similarity index 100% rename from typescript/71-Simplify-Path.ts rename to typescript/0071-simplify-path.ts diff --git a/typescript/73-Set-Matrix-Zeroes.ts b/typescript/0073-set-matrix-zeroes.ts similarity index 100% rename from typescript/73-Set-Matrix-Zeroes.ts rename to typescript/0073-set-matrix-zeroes.ts diff --git a/typescript/74-Search-a-2D-Matrix.ts b/typescript/0074-search-a-2d-matrix.ts similarity index 100% rename from typescript/74-Search-a-2D-Matrix.ts rename to typescript/0074-search-a-2d-matrix.ts diff --git a/typescript/76-Minimum-Window-Substring.ts b/typescript/0076-minimum-window-substring.ts similarity index 100% rename from typescript/76-Minimum-Window-Substring.ts rename to typescript/0076-minimum-window-substring.ts diff --git a/typescript/78-Subsets.ts b/typescript/0078-subsets.ts similarity index 100% rename from typescript/78-Subsets.ts rename to typescript/0078-subsets.ts diff --git a/typescript/84-Largest-Rectangle-in-Histogram.ts b/typescript/0084-largest-rectangle-in-histogram.ts similarity index 100% rename from typescript/84-Largest-Rectangle-in-Histogram.ts rename to typescript/0084-largest-rectangle-in-histogram.ts diff --git a/typescript/90-Subsets-II.ts b/typescript/0090-subsets-ii.ts similarity index 100% rename from typescript/90-Subsets-II.ts rename to typescript/0090-subsets-ii.ts diff --git a/typescript/91-Decode-Ways.ts b/typescript/0091-decode-ways.ts similarity index 100% rename from typescript/91-Decode-Ways.ts rename to typescript/0091-decode-ways.ts diff --git a/typescript/94-Binary-Tree-Inorder-Traversal.ts b/typescript/0094-binary-tree-inorder-traversal.ts similarity index 100% rename from typescript/94-Binary-Tree-Inorder-Traversal.ts rename to typescript/0094-binary-tree-inorder-traversal.ts diff --git a/typescript/97-Interleaving-String.ts b/typescript/0097-interleaving-string.ts similarity index 100% rename from typescript/97-Interleaving-String.ts rename to typescript/0097-interleaving-string.ts diff --git a/typescript/98-Validate-Binary-Search-Tree.ts b/typescript/0098-validate-binary-search-tree.ts similarity index 100% rename from typescript/98-Validate-Binary-Search-Tree.ts rename to typescript/0098-validate-binary-search-tree.ts diff --git a/typescript/100-Same-Tree.ts b/typescript/0100-same-tree.ts similarity index 100% rename from typescript/100-Same-Tree.ts rename to typescript/0100-same-tree.ts diff --git a/typescript/102-Binary-Tree-Level-Order-Traversal.ts b/typescript/0102-binary-tree-level-order-traversal.ts similarity index 100% rename from typescript/102-Binary-Tree-Level-Order-Traversal.ts rename to typescript/0102-binary-tree-level-order-traversal.ts diff --git a/typescript/104-Maximum-Depth-of-Binary-Tree.ts b/typescript/0104-maximum-depth-of-binary-tree.ts similarity index 100% rename from typescript/104-Maximum-Depth-of-Binary-Tree.ts rename to typescript/0104-maximum-depth-of-binary-tree.ts diff --git a/typescript/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.ts b/typescript/0105-construct-binary-tree-from-preorder-and-inorder-traversal.ts similarity index 100% rename from typescript/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.ts rename to typescript/0105-construct-binary-tree-from-preorder-and-inorder-traversal.ts diff --git a/typescript/110-Balanced-Binary-Tree.ts b/typescript/0110-balanced-binary-tree.ts similarity index 100% rename from typescript/110-Balanced-Binary-Tree.ts rename to typescript/0110-balanced-binary-tree.ts diff --git a/typescript/115-Distinct-Subsequences.ts b/typescript/0115-distinct-subsequences.ts similarity index 100% rename from typescript/115-Distinct-Subsequences.ts rename to typescript/0115-distinct-subsequences.ts diff --git a/typescript/118-Pascal-Triangle.ts b/typescript/0118-pascals-triangle.ts similarity index 100% rename from typescript/118-Pascal-Triangle.ts rename to typescript/0118-pascals-triangle.ts diff --git a/typescript/121-Best-Time-To-Buy-and-Sell-Stock.ts b/typescript/0121-best-time-to-buy-and-sell-stock.ts similarity index 100% rename from typescript/121-Best-Time-To-Buy-and-Sell-Stock.ts rename to typescript/0121-best-time-to-buy-and-sell-stock.ts diff --git a/typescript/124-Binary-Tree-Maximum-Path-Sum.ts b/typescript/0124-binary-tree-maximum-path-sum.ts similarity index 100% rename from typescript/124-Binary-Tree-Maximum-Path-Sum.ts rename to typescript/0124-binary-tree-maximum-path-sum.ts diff --git a/typescript/125-Valid-Palindrome.ts b/typescript/0125-valid-palindrome.ts similarity index 100% rename from typescript/125-Valid-Palindrome.ts rename to typescript/0125-valid-palindrome.ts diff --git a/typescript/127-Word-Ladder.ts b/typescript/0127-word-ladder.ts similarity index 100% rename from typescript/127-Word-Ladder.ts rename to typescript/0127-word-ladder.ts diff --git a/typescript/128-Longest-Consecutive-Sequence.ts b/typescript/0128-longest-consecutive-sequence.ts similarity index 100% rename from typescript/128-Longest-Consecutive-Sequence.ts rename to typescript/0128-longest-consecutive-sequence.ts diff --git a/typescript/130-Surrounded-Regions.ts b/typescript/0130-surrounded-regions.ts similarity index 100% rename from typescript/130-Surrounded-Regions.ts rename to typescript/0130-surrounded-regions.ts diff --git a/typescript/131-Palindrome-Partitioning.ts b/typescript/0131-palindrome-partitioning.ts similarity index 100% rename from typescript/131-Palindrome-Partitioning.ts rename to typescript/0131-palindrome-partitioning.ts diff --git a/typescript/133-Clone-Graph.ts b/typescript/0133-clone-graph.ts similarity index 100% rename from typescript/133-Clone-Graph.ts rename to typescript/0133-clone-graph.ts diff --git a/typescript/134-Gas-Station.ts b/typescript/0134-gas-station.ts similarity index 100% rename from typescript/134-Gas-Station.ts rename to typescript/0134-gas-station.ts diff --git a/typescript/136-Single-Number.ts b/typescript/0136-single-number.ts similarity index 100% rename from typescript/136-Single-Number.ts rename to typescript/0136-single-number.ts diff --git a/typescript/138-Copy-List-with-Random-Pointer.ts b/typescript/0138-copy-list-with-random-pointer.ts similarity index 100% rename from typescript/138-Copy-List-with-Random-Pointer.ts rename to typescript/0138-copy-list-with-random-pointer.ts diff --git a/typescript/139-Word-Break.ts b/typescript/0139-word-break.ts similarity index 100% rename from typescript/139-Word-Break.ts rename to typescript/0139-word-break.ts diff --git a/typescript/141-Linked-List-Cycle.ts b/typescript/0141-linked-list-cycle.ts similarity index 100% rename from typescript/141-Linked-List-Cycle.ts rename to typescript/0141-linked-list-cycle.ts diff --git a/typescript/143-Reorder-List.ts b/typescript/0143-reorder-list.ts similarity index 100% rename from typescript/143-Reorder-List.ts rename to typescript/0143-reorder-list.ts diff --git a/typescript/150-Evaluate-Reverse-Polish-Notation.ts b/typescript/0150-evaluate-reverse-polish-notation.ts similarity index 100% rename from typescript/150-Evaluate-Reverse-Polish-Notation.ts rename to typescript/0150-evaluate-reverse-polish-notation.ts diff --git a/typescript/152-Maximum-Product-Subarray.ts b/typescript/0152-maximum-product-subarray.ts similarity index 100% rename from typescript/152-Maximum-Product-Subarray.ts rename to typescript/0152-maximum-product-subarray.ts diff --git a/typescript/153-Find-Minimum-in-Rotated-Sorted-Array.ts b/typescript/0153-find-minimum-in-rotated-sorted-array.ts similarity index 100% rename from typescript/153-Find-Minimum-in-Rotated-Sorted-Array.ts rename to typescript/0153-find-minimum-in-rotated-sorted-array.ts diff --git a/typescript/155-Min-Stack.ts b/typescript/0155-min-stack.ts similarity index 100% rename from typescript/155-Min-Stack.ts rename to typescript/0155-min-stack.ts diff --git a/typescript/167-Two-Sum-II.ts b/typescript/0167-two-sum-ii-input-array-is-sorted.ts similarity index 100% rename from typescript/167-Two-Sum-II.ts rename to typescript/0167-two-sum-ii-input-array-is-sorted.ts diff --git a/typescript/169-Majority-Element.ts b/typescript/0169-majority-element.ts similarity index 100% rename from typescript/169-Majority-Element.ts rename to typescript/0169-majority-element.ts diff --git a/typescript/179-Largest-Number.ts b/typescript/0179-largest-number.ts similarity index 100% rename from typescript/179-Largest-Number.ts rename to typescript/0179-largest-number.ts diff --git a/typescript/190-Reverse-Bits.ts b/typescript/0190-reverse-bits.ts similarity index 100% rename from typescript/190-Reverse-Bits.ts rename to typescript/0190-reverse-bits.ts diff --git a/typescript/191-Number-of-1-Bits.ts b/typescript/0191-number-of-1-bits.ts similarity index 100% rename from typescript/191-Number-of-1-Bits.ts rename to typescript/0191-number-of-1-bits.ts diff --git a/typescript/198-House-Robber.ts b/typescript/0198-house-robber.ts similarity index 100% rename from typescript/198-House-Robber.ts rename to typescript/0198-house-robber.ts diff --git a/typescript/199-Binary-Tree-Right-Side-View.ts b/typescript/0199-binary-tree-right-side-view.ts similarity index 100% rename from typescript/199-Binary-Tree-Right-Side-View.ts rename to typescript/0199-binary-tree-right-side-view.ts diff --git a/typescript/200-Number-of-Islands.ts b/typescript/0200-number-of-islands.ts similarity index 100% rename from typescript/200-Number-of-Islands.ts rename to typescript/0200-number-of-islands.ts diff --git a/typescript/202-Happy-Number.ts b/typescript/0202-happy-number.ts similarity index 100% rename from typescript/202-Happy-Number.ts rename to typescript/0202-happy-number.ts diff --git a/typescript/203-Remove-Linked-List-Elements.ts b/typescript/0203-remove-linked-list-elements.ts similarity index 100% rename from typescript/203-Remove-Linked-List-Elements.ts rename to typescript/0203-remove-linked-list-elements.ts diff --git a/typescript/205-Isomorphic-Strings.ts b/typescript/0205-isomorphic-strings.ts similarity index 100% rename from typescript/205-Isomorphic-Strings.ts rename to typescript/0205-isomorphic-strings.ts diff --git a/typescript/206-Reverse-Linked-List.ts b/typescript/0206-reverse-linked-list.ts similarity index 100% rename from typescript/206-Reverse-Linked-List.ts rename to typescript/0206-reverse-linked-list.ts diff --git a/typescript/207-Course-Schedule.ts b/typescript/0207-course-schedule.ts similarity index 100% rename from typescript/207-Course-Schedule.ts rename to typescript/0207-course-schedule.ts diff --git a/typescript/208-Implement-Trie.ts b/typescript/0208-implement-trie-prefix-tree.ts similarity index 100% rename from typescript/208-Implement-Trie.ts rename to typescript/0208-implement-trie-prefix-tree.ts diff --git a/typescript/210-Course-Schedule-II.ts b/typescript/0210-course-schedule-ii.ts similarity index 100% rename from typescript/210-Course-Schedule-II.ts rename to typescript/0210-course-schedule-ii.ts diff --git a/typescript/211-Design-Add-and-Search-Words-Data-Structure.ts b/typescript/0211-design-add-and-search-words-data-structure.ts similarity index 100% rename from typescript/211-Design-Add-and-Search-Words-Data-Structure.ts rename to typescript/0211-design-add-and-search-words-data-structure.ts diff --git a/typescript/213-House-Robber-II.ts b/typescript/0213-house-robber-ii.ts similarity index 100% rename from typescript/213-House-Robber-II.ts rename to typescript/0213-house-robber-ii.ts diff --git a/typescript/215-Kth-Largest-Element-in-an-Array.ts b/typescript/0215-kth-largest-element-in-an-array.ts similarity index 100% rename from typescript/215-Kth-Largest-Element-in-an-Array.ts rename to typescript/0215-kth-largest-element-in-an-array.ts diff --git a/typescript/217-Contains-Duplicate.ts b/typescript/0217-contains-duplicate.ts similarity index 100% rename from typescript/217-Contains-Duplicate.ts rename to typescript/0217-contains-duplicate.ts diff --git a/typescript/226-Invert-Binary-Tree.ts b/typescript/0226-invert-binary-tree.ts similarity index 100% rename from typescript/226-Invert-Binary-Tree.ts rename to typescript/0226-invert-binary-tree.ts diff --git a/typescript/230-Kth-Smallest-Element-In-A-BST.ts b/typescript/0230-kth-smallest-element-in-a-bst.ts similarity index 100% rename from typescript/230-Kth-Smallest-Element-In-A-BST.ts rename to typescript/0230-kth-smallest-element-in-a-bst.ts diff --git a/typescript/235-Lowest-Common-Ancestor-of-a-Binary Search-Tree.ts b/typescript/0235-lowest-common-ancestor-of-a-binary-search-tree.ts similarity index 100% rename from typescript/235-Lowest-Common-Ancestor-of-a-Binary Search-Tree.ts rename to typescript/0235-lowest-common-ancestor-of-a-binary-search-tree.ts diff --git a/typescript/238-Product-of-Array-Except-Self.ts b/typescript/0238-product-of-array-except-self.ts similarity index 100% rename from typescript/238-Product-of-Array-Except-Self.ts rename to typescript/0238-product-of-array-except-self.ts diff --git a/typescript/242-Valid-Anagram.ts b/typescript/0242-valid-anagram.ts similarity index 100% rename from typescript/242-Valid-Anagram.ts rename to typescript/0242-valid-anagram.ts diff --git a/typescript/261-Graph-Valid-Tree.ts b/typescript/0261-graph-valid-tree.ts similarity index 100% rename from typescript/261-Graph-Valid-Tree.ts rename to typescript/0261-graph-valid-tree.ts diff --git a/typescript/268-Missing-Number.ts b/typescript/0268-missing-number.ts similarity index 100% rename from typescript/268-Missing-Number.ts rename to typescript/0268-missing-number.ts diff --git a/typescript/287-Find-the-Duplicate-Number.ts b/typescript/0287-find-the-duplicate-number.ts similarity index 100% rename from typescript/287-Find-the-Duplicate-Number.ts rename to typescript/0287-find-the-duplicate-number.ts diff --git a/typescript/290-Word-Pattern.ts b/typescript/0290-word-pattern.ts similarity index 100% rename from typescript/290-Word-Pattern.ts rename to typescript/0290-word-pattern.ts diff --git a/typescript/300-Longest-Increasing-Subsequence.ts b/typescript/0300-longest-increasing-subsequence.ts similarity index 100% rename from typescript/300-Longest-Increasing-Subsequence.ts rename to typescript/0300-longest-increasing-subsequence.ts diff --git a/typescript/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.ts b/typescript/0309-best-time-to-buy-and-sell-stock-with-cooldown.ts similarity index 100% rename from typescript/309-Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.ts rename to typescript/0309-best-time-to-buy-and-sell-stock-with-cooldown.ts diff --git a/typescript/312-Burst-Balloons.ts b/typescript/0312-burst-balloons.ts similarity index 100% rename from typescript/312-Burst-Balloons.ts rename to typescript/0312-burst-balloons.ts diff --git a/typescript/322-Coin-Change.ts b/typescript/0322-coin-change.ts similarity index 100% rename from typescript/322-Coin-Change.ts rename to typescript/0322-coin-change.ts diff --git a/typescript/338-Counting-Bits.ts b/typescript/0338-counting-bits.ts similarity index 100% rename from typescript/338-Counting-Bits.ts rename to typescript/0338-counting-bits.ts diff --git a/typescript/344-Reverse-String.ts b/typescript/0344-reverse-string.ts similarity index 100% rename from typescript/344-Reverse-String.ts rename to typescript/0344-reverse-string.ts diff --git a/typescript/347-Top-K-Frequent-Elements.ts b/typescript/0347-top-k-frequent-elements.ts similarity index 100% rename from typescript/347-Top-K-Frequent-Elements.ts rename to typescript/0347-top-k-frequent-elements.ts diff --git a/typescript/371-Sum-Of-Two-Integers.ts b/typescript/0371-sum-of-two-integers.ts similarity index 100% rename from typescript/371-Sum-Of-Two-Integers.ts rename to typescript/0371-sum-of-two-integers.ts diff --git a/typescript/380-Insert-Delete-GetRandom-O(1).ts b/typescript/0380-insert-delete-getrandom-o1.ts similarity index 100% rename from typescript/380-Insert-Delete-GetRandom-O(1).ts rename to typescript/0380-insert-delete-getrandom-o1.ts diff --git a/typescript/392-Is-Subsequence.ts b/typescript/0392-is-subsequence.ts similarity index 100% rename from typescript/392-Is-Subsequence.ts rename to typescript/0392-is-subsequence.ts diff --git a/typescript/424-Longest-Repeating-Character-Replacement.ts b/typescript/0424-longest-repeating-character-replacement.ts similarity index 100% rename from typescript/424-Longest-Repeating-Character-Replacement.ts rename to typescript/0424-longest-repeating-character-replacement.ts diff --git a/typescript/435-Non-overlapping-Intervals.ts b/typescript/0435-non-overlapping-intervals.ts similarity index 100% rename from typescript/435-Non-overlapping-Intervals.ts rename to typescript/0435-non-overlapping-intervals.ts diff --git a/typescript/494-Target-Sum.ts b/typescript/0494-target-sum.ts similarity index 100% rename from typescript/494-Target-Sum.ts rename to typescript/0494-target-sum.ts diff --git a/typescript/496-Next-Greater-Element-I.ts b/typescript/0496-next-greater-element-i.ts similarity index 100% rename from typescript/496-Next-Greater-Element-I.ts rename to typescript/0496-next-greater-element-i.ts diff --git a/typescript/518-Coin-Change-II.ts b/typescript/0518-coin-change-ii.ts similarity index 100% rename from typescript/518-Coin-Change-II.ts rename to typescript/0518-coin-change-ii.ts diff --git a/typescript/543-Diameter-of-Binary-Tree.ts b/typescript/0543-diameter-of-binary-tree.ts similarity index 100% rename from typescript/543-Diameter-of-Binary-Tree.ts rename to typescript/0543-diameter-of-binary-tree.ts diff --git a/typescript/554-Brick-Wall.ts b/typescript/0554-brick-wall.ts similarity index 100% rename from typescript/554-Brick-Wall.ts rename to typescript/0554-brick-wall.ts diff --git a/typescript/567-Permutation-in-String.ts b/typescript/0567-permutation-in-string.ts similarity index 100% rename from typescript/567-Permutation-in-String.ts rename to typescript/0567-permutation-in-string.ts diff --git a/typescript/572-Subtree-of-Another-Tree.ts b/typescript/0572-subtree-of-another-tree.ts similarity index 100% rename from typescript/572-Subtree-of-Another-Tree.ts rename to typescript/0572-subtree-of-another-tree.ts diff --git a/typescript/605-Can-Place-Flowers.ts b/typescript/0605-can-place-flowers.ts similarity index 100% rename from typescript/605-Can-Place-Flowers.ts rename to typescript/0605-can-place-flowers.ts diff --git a/typescript/621-Task-Scheduler.ts b/typescript/0621-task-scheduler.ts similarity index 100% rename from typescript/621-Task-Scheduler.ts rename to typescript/0621-task-scheduler.ts diff --git a/typescript/647-Palindromic-Substrings.ts b/typescript/0647-palindromic-substrings.ts similarity index 100% rename from typescript/647-Palindromic-Substrings.ts rename to typescript/0647-palindromic-substrings.ts diff --git a/typescript/669-Trim-a-Binary-Search-Tree.ts b/typescript/0669-trim-a-binary-search-tree.ts similarity index 100% rename from typescript/669-Trim-a-Binary-Search-Tree.ts rename to typescript/0669-trim-a-binary-search-tree.ts diff --git a/typescript/678-Valid-Parenthesis-String.ts b/typescript/0678-valid-parenthesis-string.ts similarity index 100% rename from typescript/678-Valid-Parenthesis-String.ts rename to typescript/0678-valid-parenthesis-string.ts diff --git a/typescript/684-Redundant-Connection.ts b/typescript/0684-redundant-connection.ts similarity index 100% rename from typescript/684-Redundant-Connection.ts rename to typescript/0684-redundant-connection.ts diff --git a/typescript/695-Max-Area-of-Island.ts b/typescript/0695-max-area-of-island.ts similarity index 100% rename from typescript/695-Max-Area-of-Island.ts rename to typescript/0695-max-area-of-island.ts diff --git a/typescript/704-Binary-Search.ts b/typescript/0704-binary-search.ts similarity index 100% rename from typescript/704-Binary-Search.ts rename to typescript/0704-binary-search.ts diff --git a/typescript/739-Daily-Temperatures.ts b/typescript/0739-daily-temperatures.ts similarity index 100% rename from typescript/739-Daily-Temperatures.ts rename to typescript/0739-daily-temperatures.ts diff --git a/typescript/746-Min-Cost-Climbing-Stairs.ts b/typescript/0746-min-cost-climbing-stairs.ts similarity index 100% rename from typescript/746-Min-Cost-Climbing-Stairs.ts rename to typescript/0746-min-cost-climbing-stairs.ts diff --git a/typescript/787-Cheapest-Flights-Within-K-Stops.ts b/typescript/0787-cheapest-flights-within-k-stops.ts similarity index 100% rename from typescript/787-Cheapest-Flights-Within-K-Stops.ts rename to typescript/0787-cheapest-flights-within-k-stops.ts diff --git a/typescript/846-Hand-of-Straights.ts b/typescript/0846-hand-of-straights.ts similarity index 100% rename from typescript/846-Hand-of-Straights.ts rename to typescript/0846-hand-of-straights.ts diff --git a/typescript/853-Car-Fleet.ts b/typescript/0853-car-fleet.ts similarity index 100% rename from typescript/853-Car-Fleet.ts rename to typescript/0853-car-fleet.ts diff --git a/typescript/875-Koko-Eating-Bananas.ts b/typescript/0875-koko-eating-bananas.ts similarity index 100% rename from typescript/875-Koko-Eating-Bananas.ts rename to typescript/0875-koko-eating-bananas.ts diff --git a/typescript/929-Unique-Email-Addresses.ts b/typescript/0929-unique-email-addresses.ts similarity index 100% rename from typescript/929-Unique-Email-Addresses.ts rename to typescript/0929-unique-email-addresses.ts diff --git a/typescript/981-Time-Based-Key-Value-Store.ts b/typescript/0981-time-based-key-value-store.ts similarity index 100% rename from typescript/981-Time-Based-Key-Value-Store.ts rename to typescript/0981-time-based-key-value-store.ts diff --git a/typescript/994-Rotting-Oranges.ts b/typescript/0994-rotting-oranges.ts similarity index 100% rename from typescript/994-Rotting-Oranges.ts rename to typescript/0994-rotting-oranges.ts diff --git a/typescript/1046-last-stone-weight.ts b/typescript/1046-last-stone-weight.ts new file mode 100644 index 000000000..3a1b702df --- /dev/null +++ b/typescript/1046-last-stone-weight.ts @@ -0,0 +1,78 @@ +class MaxHeap { + heap: number[]; + constructor(array: number[]) { + this.heap = this.buildHeap(array); + } + + buildHeap(array: number[]) { + let parentIdx = Math.floor((array.length - 2) / 2); + for (let i = parentIdx; i >= 0; i--) { + this.siftDown(i, array.length - 1, array); + } + return array; + } + + siftDown(idx: number, endIdx: number, heap: number[]) { + let childOneIdx = 2 * idx + 1; + + while (childOneIdx <= endIdx) { + let childTwoIdx = 2 * idx + 2 <= endIdx ? 2 * idx + 2 : -1; + let swapIdx; + if (childTwoIdx !== -1 && heap[childOneIdx] < heap[childTwoIdx]) { + swapIdx = childTwoIdx; + } else swapIdx = childOneIdx; + if (heap[swapIdx] > heap[idx]) { + this.swap(swapIdx, idx, heap); + idx = swapIdx; + childOneIdx = 2 * idx + 1; + } else return; + } + } + + siftUp(idx: number, heap: number[]) { + let parentIdx = Math.floor((idx - 1) / 2); + while (heap[parentIdx] < heap[idx] && idx > 0) { + this.swap(parentIdx, idx, heap); + idx = parentIdx; + parentIdx = Math.floor((idx - 1) / 2); + } + } + + peek() { + return this.heap[0]; + } + + remove() { + this.swap(this.heap.length - 1, 0, this.heap); + const removeValue = this.heap.pop(); + this.siftDown(0, this.heap.length - 1, this.heap); + return removeValue; + } + + size() { + return this.heap.length; + } + + insert(value: number) { + this.heap.push(value); + this.siftUp(this.heap.length - 1, this.heap); + } + swap(i: number, j: number, arr: number[]) { + let ele = arr[i]; + arr[i] = arr[j]; + arr[j] = ele; + } +} + +function lastStoneWeight(stones: number[]): number { + const heap = new MaxHeap(stones); + + while (heap.size() > 1) { + const stone1 = heap.remove(); + const stone2 = heap.remove(); + + heap.insert(stone1 - stone2); + } + + return heap.peek(); +} diff --git a/typescript/1143-longest-common-subsequence.ts b/typescript/1143-longest-common-subsequence.ts new file mode 100644 index 000000000..532bcbbe4 --- /dev/null +++ b/typescript/1143-longest-common-subsequence.ts @@ -0,0 +1,20 @@ +function longestCommonSubsequence(text1: string, text2: string): number { + let temp: number[][] = []; + let max: number = 0; + for (let i = 0; i <= text1.length; i++) { + temp.push(new Array(text2.length + 1).fill(0)); + } + + for (let i = 1; i < temp.length; i++) { + for (let j = 1; j < temp[0].length; j++) { + if (text1[i - 1] === text2[j - 1]) { + temp[i][j] = temp[i - 1][j - 1] + 1; + } else { + temp[i][j] = Math.max(temp[i - 1][j], temp[i][j - 1]); + } + max = Math.max(max, temp[i][j]); + } + } + + return max; +} diff --git a/typescript/1299-replace-elements-with-greatest-element-on-right-side.ts b/typescript/1299-replace-elements-with-greatest-element-on-right-side.ts new file mode 100644 index 000000000..6916a1834 --- /dev/null +++ b/typescript/1299-replace-elements-with-greatest-element-on-right-side.ts @@ -0,0 +1,12 @@ +function replaceElements(arr: number[]): number[] { + let currMax = -1; + + for(let i = arr.length -1 ; i >= 0; i--) { + let newMax = Math.max(currMax, arr[i]); + arr[i] = currMax; + + currMax = newMax; + } + + return arr; +}; diff --git a/typescript/1448-count-good-nodes-in-binary-tree.ts b/typescript/1448-count-good-nodes-in-binary-tree.ts new file mode 100644 index 000000000..b0efb630c --- /dev/null +++ b/typescript/1448-count-good-nodes-in-binary-tree.ts @@ -0,0 +1,21 @@ +function goodNodes(root: TreeNode | null): number { + // edge case + if (root === null) return 0; + + //keep track of the count + let count = 0; + + const dfs = (root, max) => { + //if value is bigger than max of path, then it is a good node + if (root.val >= max) count++; + + //extend search to children if not null with updated max(takes current node in consideration too) + if (root.left !== null) dfs(root.left, Math.max(max, root.val)); + if (root.right !== null) dfs(root.right, Math.max(max, root.val)); + }; + + //starts with negative max value, because min value is just the smaller positive value in javascript + dfs(root, -Number.MAX_VALUE); + + return count; +} diff --git a/updateSiteData.js b/updateSiteData.js new file mode 100644 index 000000000..19614b834 --- /dev/null +++ b/updateSiteData.js @@ -0,0 +1,151 @@ +/** Script to update ./.problemSiteData.json contains code for solutions hosted on neetcode.io */ + +const fs = require('fs'); + +const PROBLEMS_OBJ = JSON.parse(fs.readFileSync('./.problemList.json', 'utf8')); +const PROBLEMS_SITE_DATA = JSON.parse(fs.readFileSync('./.problemSiteData.json', 'utf8')); + +const languages = [ + { + name: 'C', + directory: 'c', + extension: 'c' + }, + { + name: 'C++', + directory: 'cpp', + extension: 'cpp' + }, + { + name: 'C#', + directory: 'csharp', + extension: 'cs' + }, + { + name: 'Java', + directory: 'java', + extension: 'java' + }, + { + name: 'Python', + directory: 'python', + extension: 'py' + }, + { + name: 'JavaScript', + directory: 'javascript', + extension: 'js' + }, + { + name: 'TypeScript', + directory: 'typescript', + extension: 'ts' + }, + { + name: 'Go', + directory: 'go', + extension: 'go' + }, + { + name: 'Ruby', + directory: 'ruby', + extension: 'rb' + }, + { + name: 'Swift', + directory: 'swift', + extension: 'swift' + }, + { + name: 'Kotlin', + directory: 'kotlin', + extension: 'kt' + }, + { + name: 'Rust', + directory: 'rust', + extension: 'rs' + }, + { + name: 'Scala', + directory: 'scala', + extension: 'scala' + }, +] + +// Rename files to match leetcode url path, and normalize problem number to four digits. +for (const lang of languages) { + const langDir = lang.directory; + const langExt = lang.extension; + + // Get list of all files in the current lang directory + const files = fs.readdirSync(langDir, { withFileTypes: true }); + console.log(`This many files in ${langDir}: ${files.length}`); + + let counter = 0; + for (const category in PROBLEMS_OBJ) { + for (const problem of PROBLEMS_OBJ[category]) { + const url = problem[1]; + + // Use leetcode url path to rename each problem for consistency + let problemName = problem[1].replace('https://leetcode.com/problems/', ''); + problemName = problemName.replace('/', '').toLowerCase(); + + // Use problem number to find each problem + const problemNumber = problem[2]; + const newProblemNumber = updateProblemNumber(problem[2]); + + const foundFile = files.find(file => file.name.startsWith(`${problemNumber.toString()}-`)); + if (foundFile && foundFile.isFile()) { + // rename file to match leetcode url path + const oldFile = `${langDir}/${foundFile.name}`; + const newFile = `${langDir}/${newProblemNumber}-${problemName}.${langExt}`; + fs.renameSync(oldFile, newFile); + counter++; + + updateSiteData(url, `${newProblemNumber}-${problemName}`, langDir); + } + } + } + console.log(`Renamed ${counter} files in ${langDir}, which had ${files.length} total files.`); +} + +// Add leading zeros to make four digits long (24 -> 0024) +function updateProblemNumber(problemNumberInt) { + let problemNumber = problemNumberInt.toString(); + while (problemNumber.length < 4) { + problemNumber = '0' + problemNumber; + } + return problemNumber; +} + +function updateSiteData(problemUrl, newCodeLink, langName) { + for (const p of PROBLEMS_SITE_DATA) { + if (problemUrl.includes(p.link)) { + p.code = newCodeLink; + p[langName] = true; + return; + } + } + console.log(`Could not find ${problemUrl} in PROBLEMS_SITE_DATA.`); +} + + +fs.writeFile('./.problemSiteData.json', JSON.stringify(PROBLEMS_SITE_DATA), function (err) { + if (err) throw err; + console.log('Saved!'); +}); + + +/** Update problem numbers in .problemList.json */ + +// for (const category in PROBLEMS_OBJ) { +// for (const problem of PROBLEMS_OBJ[category]) { +// problem[2] = updateProblemNumber(problem[2]); +// } +// } + +// fs.writeFile('./.problemList.json', JSON.stringify(PROBLEMS_OBJ), function (err) { +// if (err) throw err; +// console.log('Saved!'); +// }); \ No newline at end of file diff --git a/verifySiteData.js b/verifySiteData.js new file mode 100644 index 000000000..74c37bdc9 --- /dev/null +++ b/verifySiteData.js @@ -0,0 +1,91 @@ +/** Script to verify code links in ./.problemSiteData.json */ + +const fs = require('fs'); +const https = require('/opt/homebrew/lib/node_modules/sync-request'); + +const PROBLEMS_SITE_DATA = JSON.parse(fs.readFileSync('./.problemSiteData.json', 'utf8')); + +const languageMap = { + c: { + name: 'C', + directory: 'c', + extension: 'c' + }, + cpp: { + name: 'C++', + directory: 'cpp', + extension: 'cpp' + }, + csharp: { + name: 'C#', + directory: 'csharp', + extension: 'cs' + }, + java: { + name: 'Java', + directory: 'java', + extension: 'java' + }, + python: { + name: 'Python', + directory: 'python', + extension: 'py' + }, + javascript: { + name: 'JavaScript', + directory: 'javascript', + extension: 'js' + }, + typescript: { + name: 'TypeScript', + directory: 'typescript', + extension: 'ts' + }, + go: { + name: 'Go', + directory: 'go', + extension: 'go' + }, + ruby: { + name: 'Ruby', + directory: 'ruby', + extension: 'rb' + }, + swift: { + name: 'Swift', + directory: 'swift', + extension: 'swift' + }, + kotlin: { + name: 'Kotlin', + directory: 'kotlin', + extension: 'kt' + }, + rust: { + name: 'Rust', + directory: 'rust', + extension: 'rs' + }, + scala: { + name: 'Scala', + directory: 'scala', + extension: 'scala' + }, +}; + +const GITHUB_BASE_URL = 'https://github.com/neetcode-gh/leetcode/blob/nc-refactor'; + +for (const problem of PROBLEMS_SITE_DATA) { + for (const language in languageMap) { + if (problem[language] !== true) continue; + + const { directory, extension } = languageMap[language]; + const codeUrl = `${GITHUB_BASE_URL}/${directory}/${problem.code}.${extension}`; + + const res = https('GET', codeUrl).statusCode; + if (res !== 200) { + console.log(codeUrl) + console.log(res) + } + } +}