├── 2732-counter ├── Notes.md └── counter.js ├── 2145-grid-game └── Notes.md ├── 2742-group-by ├── Notes.md └── group-by.js ├── 494-target-sum └── Notes.md ├── 1731-even-odd-tree └── Notes.md ├── 2509-minimize-xor └── Notes.md ├── 3447-clear-digits └── Notes.md ├── 38-count-and-say └── Notes.md ├── 670-maximum-swap └── Notes.md ├── 677-map-sum-pairs └── Notes.md ├── 729-my-calendar-i └── Notes.md ├── 753-open-the-lock └── Notes.md ├── 812-rotate-string ├── Notes.md └── rotate-string.py ├── 868-push-dominoes └── Notes.md ├── 952-word-subsets └── Notes.md ├── 985-bag-of-tokens ├── Notes.md └── bag-of-tokens.py ├── 1240-stone-game-ii └── Notes.md ├── 1583-paint-house-iii └── Notes.md ├── 1755-defuse-the-bomb └── Notes.md ├── 179-largest-number └── Notes.md ├── 261-graph-valid-tree └── Notes.md ├── 264-ugly-number-ii └── Notes.md ├── 265-paint-house-ii └── Notes.md ├── 2690-house-robber-iv └── Notes.md ├── 3257-maximize-items └── Notes.md ├── 330-patching-array └── Notes.md ├── 463-island-perimeter └── Notes.md ├── 621-task-scheduler └── Notes.md ├── 650-2-keys-keyboard └── Notes.md ├── 664-strange-printer └── Notes.md ├── 726-number-of-atoms └── Notes.md ├── 731-my-calendar-ii └── Notes.md ├── 740-delete-and-earn └── Notes.md ├── 787-sliding-puzzle └── Notes.md ├── 871-keys-and-rooms ├── Notes.md └── keys-and-rooms.py ├── 1237-reported-posts-ii └── Notes.md ├── 1259-article-views-ii ├── Notes.md └── article-views-ii.sql ├── 1972-rotating-the-box └── Notes.md ├── 2035-count-sub-islands └── Notes.md ├── 2089-maximum-matrix-sum └── Notes.md ├── 2411-spiral-matrix-iv └── Notes.md ├── 2479-meeting-rooms-iii └── Notes.md ├── 2483-task-scheduler-ii └── Notes.md ├── 251-flatten-2d-vector └── Notes.md ├── 2580-circular-sentence ├── Notes.md └── circular-sentence.py ├── 2846-robot-collisions └── Notes.md ├── 3189-find-champion-ii └── Notes.md ├── 3394-minimum-array-end └── Notes.md ├── 476-number-complement └── Notes.md ├── 610-triangle-judgement ├── Notes.md └── triangle-judgement.sql ├── 807-custom-sort-string ├── Notes.md └── custom-sort-string.py ├── 85-maximal-rectangle └── Notes.md ├── 1002-maximum-width-ramp └── Notes.md ├── 1193-game-play-analysis-v └── Notes.md ├── 1269-market-analysis-ii └── Notes.md ├── 1304-longest-happy-string └── Notes.md ├── 1318-tournament-winners └── Notes.md ├── 1500-count-largest-group └── Notes.md ├── 1558-course-schedule-iv └── Notes.md ├── 1656-count-good-triplets └── Notes.md ├── 1702-bank-account-summary └── Notes.md ├── 1876-map-of-highest-peak └── Notes.md ├── 214-shortest-palindrome └── Notes.md ├── 2465-shifting-letters-ii └── Notes.md ├── 2681-put-marbles-in-bags └── Notes.md ├── 2868-continuous-subarrays └── Notes.md ├── 3288-top-three-wineries └── Notes.md ├── 3301-friday-purchases-ii └── Notes.md ├── 3400-find-bursty-behavior └── Notes.md ├── 633-sum-of-square-numbers └── Notes.md ├── 684-redundant-connection └── Notes.md ├── 859-design-circular-deque └── Notes.md ├── 1044-find-common-characters └── Notes.md ├── 1063-best-sightseeing-pair └── Notes.md ├── 1226-user-purchase-platform └── Notes.md ├── 1236-n-th-tribonacci-number └── Notes.md ├── 1511-count-number-of-teams └── Notes.md ├── 165-compare-version-numbers └── Notes.md ├── 1666-make-the-string-great └── Notes.md ├── 2046-page-recommendations-ii └── Notes.md ├── 220-contains-duplicate-iii └── Notes.md ├── 234-palindrome-linked-list └── Notes.md ├── 2478-longest-nice-subarray ├── Notes.md └── longest-nice-subarray.py ├── 2792-neighboring-bitwise-xor └── Notes.md ├── 3483-alternating-groups-ii └── Notes.md ├── 386-lexicographical-numbers └── Notes.md ├── 407-trapping-rain-water-ii └── Notes.md ├── 410-split-array-largest-sum └── Notes.md ├── 432-all-oone-data-structure └── Notes.md ├── 523-continuous-subarray-sum └── Notes.md ├── 539-minimum-time-difference └── Notes.md ├── 567-permutation-in-string └── Notes.md ├── 569-median-employee-salary └── Notes.md ├── 1025-minimum-cost-for-tickets └── Notes.md ├── 1196-filling-bookcase-shelves └── Notes.md ├── 1301-reformat-department-table └── Notes.md ├── 1435-xor-queries-of-a-subarray └── Notes.md ├── 1694-make-sum-divisible-by-p └── Notes.md ├── 1779-hopper-company-queries-i └── Notes.md ├── 1923-sentence-similarity-iii └── Notes.md ├── 2155-find-missing-observations └── Notes.md ├── 2232-adding-spaces-to-a-string └── Notes.md ├── 2444-longest-ideal-subsequence └── Notes.md ├── 2448-count-number-of-bad-pairs └── Notes.md ├── 2677-cousins-in-binary-tree-ii └── Notes.md ├── 287-find-the-duplicate-number └── Notes.md ├── 2998-count-symmetric-integers └── Notes.md ├── 3055-maximum-odd-binary-number ├── Notes.md └── maximum-odd-binary-number.py ├── 3302-viewers-turned-streamers └── Notes.md ├── 3488-find-top-scoring-students └── Notes.md ├── 3530-odd-and-even-transactions ├── Notes.md └── odd-and-even-transactions.sql ├── 3549-ceo-subordinate-hierarchy └── Notes.md ├── 368-largest-divisible-subset └── Notes.md ├── 678-valid-parenthesis-string └── Notes.md ├── 780-max-chunks-to-make-sorted └── Notes.md ├── 820-find-eventual-safe-states └── Notes.md ├── 863-sum-of-distances-in-tree └── Notes.md ├── 906-walking-robot-simulation └── Notes.md ├── 966-binary-subarrays-with-sum ├── Notes.md └── binary-subarrays-with-sum.py ├── 1256-rank-transform-of-an-array ├── Notes.md └── rank-transform-of-an-array.py ├── 1484-linked-list-in-binary-tree └── Notes.md ├── 1518-total-sales-amount-by-year └── Notes.md ├── 1524-string-matching-in-an-array └── Notes.md ├── 1795-hopper-company-queries-iii └── Notes.md ├── 1917-maximum-average-pass-ratio └── Notes.md ├── 1940-maximum-xor-for-each-query └── Notes.md ├── 2048-build-array-from-permutation ├── Notes.md └── build-array-from-permutation.py ├── 2103-find-all-groups-of-farmland └── Notes.md ├── 2201-valid-arrangement-of-pairs └── Notes.md ├── 2215-finding-3-digit-even-numbers └── Notes.md ├── 2249-count-the-hidden-sequences └── Notes.md ├── 2299-merge-nodes-in-between-zeros └── Notes.md ├── 2381-dynamic-pivoting-of-a-table └── Notes.md ├── 2533-bitwise-xor-of-all-pairings └── Notes.md ├── 2551-apply-operations-to-an-array └── Notes.md ├── 2665-minimum-time-to-repair-cars └── Notes.md ├── 2716-prime-subtraction-operation └── Notes.md ├── 2755-extra-characters-in-a-string └── Notes.md ├── 3291-find-if-array-can-be-sorted └── Notes.md ├── 3430-count-days-without-meetings └── Notes.md ├── 3585-find-overlapping-shifts-ii └── Notes.md ├── 3639-zero-array-transformation-i └── Notes.md ├── 3643-zero-array-transformation-ii └── Notes.md ├── 3767-find-students-who-improved └── Notes.md ├── 513-find-bottom-left-tree-value └── Notes.md ├── 538-convert-bst-to-greater-tree └── Notes.md ├── 552-student-attendance-record-ii └── Notes.md ├── 564-find-the-closest-palindrome └── Notes.md ├── 624-maximum-distance-in-arrays └── Notes.md ├── 802-k-th-smallest-prime-fraction └── Notes.md ├── 853-most-profit-assigning-work └── Notes.md ├── 891-score-after-flipping-matrix └── Notes.md ├── 988-flip-equivalent-binary-trees └── Notes.md ├── 1021-distribute-coins-in-binary-tree └── Notes.md ├── 1171-shortest-path-in-binary-matrix └── Notes.md ├── 1197-parsing-a-boolean-expression └── Notes.md ├── 1285-balance-a-binary-search-tree └── Notes.md ├── 1325-path-with-maximum-probability └── Notes.md ├── 1370-count-number-of-nice-subarrays └── Notes.md ├── 1396-count-servers-that-communicate └── Notes.md ├── 1477-product-of-the-last-k-numbers └── Notes.md ├── 1502-construct-k-palindrome-strings └── Notes.md ├── 1510-find-lucky-integer-in-an-array ├── Notes.md └── find-lucky-integer-in-an-array.py ├── 1927-maximum-ascending-subarray-sum └── Notes.md ├── 1993-sum-of-all-subset-xor-totals ├── Notes.md └── sum-of-all-subset-xor-totals.py ├── 2308-divide-array-into-equal-pairs ├── Notes.md └── divide-array-into-equal-pairs.py ├── 2335-finding-the-topic-of-each-post └── Notes.md ├── 2358-number-of-ways-to-split-array └── Notes.md ├── 2414-move-pieces-to-obtain-a-string └── Notes.md ├── 2472-build-a-matrix-with-conditions └── Notes.md ├── 2564-most-profitable-path-in-a-tree └── Notes.md ├── 2573-remove-nodes-from-linked-list └── Notes.md ├── 2691-count-vowel-strings-in-ranges └── Notes.md ├── 2699-count-the-number-of-fair-pairs └── Notes.md ├── 2888-minimum-index-of-a-valid-split └── Notes.md ├── 2914-find-the-safest-path-in-a-grid └── Notes.md ├── 2915-count-of-interesting-subarrays └── Notes.md ├── 3194-find-words-containing-character ├── Notes.md └── find-words-containing-character.py ├── 334-increasing-triplet-subsequence └── Notes.md ├── 3358-friends-with-no-mutual-friends └── Notes.md ├── 3369-calculate-trapping-rain-water └── Notes.md ├── 3448-consecutive-available-seats-ii └── Notes.md ├── 887-minimum-cost-to-hire-k-workers └── Notes.md ├── 1227-number-of-equivalent-domino-pairs ├── Notes.md └── number-of-equivalent-domino-pairs.py ├── 1450-delete-leaves-with-a-given-value └── Notes.md ├── 1468-check-if-n-and-its-double-exist ├── Notes.md └── check-if-n-and-its-double-exist.py ├── 1615-range-sum-of-sorted-subarray-sums ├── Notes.md └── range-sum-of-sorted-subarray-sums.py ├── 1653-number-of-good-leaf-nodes-pairs └── Notes.md ├── 182-duplicate-emails └── duplicate-emails.sql ├── 1886-minimum-limit-of-balls-in-a-bag └── Notes.md ├── 2143-count-the-number-of-experiments └── Notes.md ├── 2163-kth-distinct-string-in-an-array └── Notes.md ├── 2164-two-best-non-overlapping-events └── Notes.md ├── 2379-maximum-total-importance-of-roads └── Notes.md ├── 241-different-ways-to-add-parentheses └── Notes.md ├── 2434-design-a-number-container-system └── Notes.md ├── 2484-compute-the-rank-as-a-percentage └── Notes.md ├── 2494-sum-of-prefix-scores-of-strings └── Notes.md ├── 2554-minimum-total-distance-traveled └── Notes.md ├── 2562-count-ways-to-build-good-strings └── Notes.md ├── 2586-longest-square-streak-in-an-array └── Notes.md ├── 2646-kth-largest-sum-in-a-binary-tree └── Notes.md ├── 2674-make-the-prefix-sum-non-negative └── Notes.md ├── 2692-take-gifts-from-the-richest-pile └── Notes.md ├── 2696-the-number-of-beautiful-subsets └── Notes.md ├── 270-closest-binary-search-tree-value └── Notes.md ├── 2764-maximum-number-of-fish-in-a-grid └── Notes.md ├── 3227-find-missing-and-repeated-values └── Notes.md ├── 3235-minimum-cost-to-convert-string-i └── Notes.md ├── 3309-count-prefix-and-suffix-pairs-i └── Notes.md ├── 3617-find-the-original-typed-string-i ├── Notes.md └── find-the-original-typed-string-i.py ├── 592-fraction-addition-and-subtraction └── Notes.md ├── 759-set-intersection-size-at-least-two ├── Notes.md └── set-intersection-size-at-least-two.py ├── 920-uncommon-words-from-two-sentences └── Notes.md ├── 1034-subarrays-with-k-different-integers └── Notes.md ├── 1321-get-equal-substrings-within-budget └── Notes.md ├── 1667-find-kth-bit-in-nth-binary-string └── Notes.md ├── 1741-sort-array-by-increasing-frequency └── Notes.md ├── 1827-invalid-tweets └── invalid-tweets.sql ├── 1942-primary-department-for-each-employee ├── Notes.md └── primary-department-for-each-employee.sql ├── 1951-find-the-winner-of-the-circular-game └── Notes.md ├── 2067-maximum-number-of-points-with-cost └── Notes.md ├── 2120-first-and-last-call-on-the-same-day └── Notes.md ├── 2179-most-beautiful-item-for-each-query └── Notes.md ├── 2262-solving-questions-with-brainpower └── Notes.md ├── 2292-counting-words-with-a-given-prefix ├── Notes.md └── counting-words-with-a-given-prefix.py ├── 2300-construct-string-with-repeat-limit └── Notes.md ├── 2343-count-unguarded-cells-in-the-grid └── Notes.md ├── 2493-reverse-odd-levels-of-binary-tree └── Notes.md ├── 2527-count-subarrays-with-fixed-bounds └── Notes.md ├── 2649-count-total-number-of-colored-cells ├── Notes.md └── count-total-number-of-colored-cells.py ├── 2794-maximum-number-of-moves-in-a-grid └── Notes.md ├── 3307-find-the-maximum-sum-of-node-values └── Notes.md ├── 3473-calculate-parking-fees-and-duration └── Notes.md ├── 515-find-largest-value-in-each-tree-row └── Notes.md ├── 580-count-student-number-in-departments └── Notes.md ├── 718-maximum-length-of-repeated-subarray └── Notes.md ├── 1093-recover-a-tree-from-preorder-traversal └── Notes.md ├── 1302-delete-characters-to-make-fancy-string └── Notes.md ├── 1350-remove-sub-folders-from-the-filesystem └── Notes.md ├── 1402-count-square-submatrices-with-all-ones └── Notes.md ├── 154-find-minimum-in-rotated-sorted-array-ii └── Notes.md ├── 1849-maximum-absolute-sum-of-any-subarray └── Notes.md ├── 2021-remove-all-occurrences-of-a-substring └── Notes.md ├── 2281-the-number-of-passengers-in-each-bus-i └── Notes.md ├── 2306-create-binary-tree-from-descriptions └── Notes.md ├── 2394-count-subarrays-with-score-less-than-k └── Notes.md ├── 2438-find-closest-node-to-given-two-nodes └── Notes.md ├── 2685-first-completely-painted-row-or-column └── Notes.md ├── 2707-merge-two-2d-arrays-by-summing-values └── Notes.md ├── 2856-count-complete-subarrays-in-an-array └── Notes.md ├── 297-serialize-and-deserialize-binary-tree └── Notes.md ├── 3002-flight-occupancy-and-waitlist-analysis └── Notes.md ├── 3154-maximum-value-of-an-ordered-triplet-i └── Notes.md ├── 3201-distribute-candies-among-children-ii └── Notes.md ├── 3242-count-elements-with-maximum-frequency ├── Notes.md └── count-elements-with-maximum-frequency.py ├── 3281-find-peak-calling-hours-for-each-city └── Notes.md ├── 3522-find-the-power-of-k-size-subarrays-i └── Notes.md ├── 3523-find-the-power-of-k-size-subarrays-ii └── Notes.md ├── 3872-find-most-frequent-vowel-and-consonant └── Notes.md ├── 440-k-th-smallest-in-lexicographical-order └── Notes.md ├── 579-find-cumulative-salary-of-an-employee └── Notes.md ├── 615-average-salary-departments-vs-company └── Notes.md ├── 765-serialize-and-deserialize-n-ary-tree └── Notes.md ├── 892-shortest-subarray-with-sum-at-least-k └── Notes.md ├── 957-minimum-add-to-make-parentheses-valid └── Notes.md ├── 982-minimum-increment-to-make-array-unique ├── Notes.md └── minimum-increment-to-make-array-unique.py ├── 1049-minimum-domino-rotations-for-equal-row └── Notes.md ├── 1218-lowest-common-ancestor-of-deepest-leaves └── Notes.md ├── 1371-minimum-remove-to-make-valid-parentheses └── Notes.md ├── 1497-design-a-stack-with-increment-operation └── Notes.md ├── 1620-check-if-array-pairs-are-divisible-by-k └── Notes.md ├── 1737-maximum-nesting-depth-of-the-parentheses └── Notes.md ├── 1802-number-of-students-unable-to-eat-lunch └── Notes.md ├── 1818-maximum-score-from-removing-substrings └── Notes.md ├── 2148-minimum-number-of-moves-to-seat-everyone ├── Notes.md └── minimum-number-of-moves-to-seat-everyone.py ├── 2265-partition-array-according-to-given-pivot └── Notes.md ├── 2320-find-all-k-distant-indices-in-an-array └── Notes.md ├── 2375-minimum-obstacle-removal-to-reach-corner └── Notes.md ├── 2456-construct-smallest-number-from-di-string └── Notes.md ├── 2581-divide-players-into-teams-of-equal-skill └── Notes.md ├── 2711-minimum-time-to-visit-a-cell-in-a-grid └── Notes.md ├── 2793-count-the-number-of-complete-components └── Notes.md ├── 3058-maximum-number-of-k-divisible-components └── Notes.md ├── 3276-minimum-number-of-pushes-to-type-word-ii └── Notes.md ├── 3351-maximize-happiness-of-selected-children └── Notes.md ├── 3380-shortest-subarray-with-or-at-least-k-ii └── Notes.md ├── 3600-find-the-k-th-character-in-string-game-i └── Notes.md ├── 3627-find-minimum-time-to-reach-last-room-i └── Notes.md ├── 766-flatten-a-multilevel-doubly-linked-list └── Notes.md ├── 811-number-of-subarrays-with-bounded-maximum └── Notes.md ├── 1037-minimum-number-of-k-consecutive-bit-flips └── Notes.md ├── 1258-article-views-i └── article-views-i.sql ├── 1387-find-elements-in-a-contaminated-binary-tree └── Notes.md ├── 1605-minimum-number-of-days-to-make-m-bouquets └── Notes.md ├── 1711-find-valid-matrix-given-row-and-column-sums └── Notes.md ├── 1756-minimum-deletions-to-make-string-balanced └── Notes.md ├── 2170-count-number-of-maximum-bitwise-or-subsets └── Notes.md ├── 2221-check-if-a-parentheses-string-can-be-valid └── Notes.md ├── 2277-count-equal-and-divisible-pairs-in-an-array ├── Notes.md └── count-equal-and-divisible-pairs-in-an-array.py ├── 2473-max-sum-of-a-pair-with-equal-sum-of-digits └── Notes.md ├── 2503-longest-subarray-with-maximum-bitwise-and └── Notes.md ├── 2766-find-the-prefix-common-array-of-two-arrays └── Notes.md ├── 3172-divisible-and-non-divisible-sums-difference ├── Notes.md └── divisible-and-non-divisible-sums-difference.py ├── 3181-find-building-where-alice-and-bob-can-meet └── Notes.md ├── 3251-maximum-area-of-longest-diagonal-rectangle └── Notes.md ├── 3455-minimum-length-of-string-after-operations └── Notes.md ├── 689-maximum-sum-of-3-non-overlapping-subarrays └── Notes.md ├── 1147-flip-columns-for-maximum-number-of-equal-rows └── Notes.md ├── 1556-make-two-arrays-equal-by-reversing-subarrays ├── Notes.md └── make-two-arrays-equal-by-reversing-subarrays.py ├── 1889-check-if-number-is-a-sum-of-powers-of-three └── Notes.md ├── 2006-find-the-student-that-will-replace-the-chalk └── Notes.md ├── 2054-the-number-of-the-smallest-unoccupied-chair └── Notes.md ├── 2220-find-all-possible-recipes-from-given-supplies └── Notes.md ├── 2246-maximum-employees-to-be-invited-to-a-meeting └── Notes.md ├── 2599-take-k-of-each-character-from-left-and-right └── Notes.md ├── 2613-customers-with-strictly-increasing-purchases └── Notes.md ├── 3143-longest-unequal-adjacent-groups-subsequence-i └── Notes.md ├── 3329-find-the-length-of-the-longest-common-prefix └── Notes.md ├── 632-smallest-range-covering-elements-from-k-lists └── Notes.md ├── 1570-final-prices-with-a-special-discount-in-a-shop └── Notes.md ├── 1915-check-if-one-string-swap-can-make-strings-equal └── Notes.md ├── 2144-maximum-difference-between-increasing-elements └── Notes.md ├── 2488-divide-intervals-into-minimum-number-of-groups └── Notes.md ├── 2572-append-characters-to-string-to-make-subsequence └── Notes.md ├── 2800-minimum-string-length-after-removing-substrings └── Notes.md ├── 2903-insert-greatest-common-divisors-in-linked-list └── Notes.md ├── 3332-minimum-operations-to-exceed-threshold-value-ii └── Notes.md ├── 3517-shortest-distance-after-road-addition-queries-i └── Notes.md ├── 3685-count-subarrays-of-length-three-with-a-condition ├── Notes.md └── count-subarrays-of-length-three-with-a-condition.py ├── 596-classes-more-than-5-students └── classes-more-than-5-students.sql ├── 627-swap-salary └── swap-salary.sql ├── 1267-remove-zero-sum-consecutive-nodes-from-linked-list └── Notes.md ├── 1766-minimum-number-of-removals-to-make-mountain-array └── Notes.md ├── 2387-partition-array-such-that-maximum-difference-is-k └── Notes.md ├── 2463-minimum-recolors-to-get-k-consecutive-black-blocks └── Notes.md ├── 2695-find-score-of-an-array-after-marking-all-elements └── Notes.md ├── 3018-make-string-a-subsequence-using-cyclic-increments └── Notes.md ├── 3434-find-the-number-of-distinct-colors-among-the-balls └── Notes.md ├── 3621-minimum-operations-to-make-array-values-equal-to-k ├── Notes.md └── minimum-operations-to-make-array-values-equal-to-k.py ├── 1050-construct-binary-search-tree-from-preorder-traversal └── Notes.md ├── 1298-reverse-substrings-between-each-pair-of-parentheses ├── Notes.md └── reverse-substrings-between-each-pair-of-parentheses.py ├── 1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph └── Notes.md ├── 1460-number-of-substrings-containing-all-three-characters └── Notes.md ├── 1529-max-difference-you-can-get-from-changing-an-integer └── Notes.md ├── 1553-count-triplets-that-can-form-two-arrays-of-equal-xor └── Notes.md ├── 1664-find-users-with-valid-e-mails └── find-users-with-valid-e-mails.sql ├── 1670-patients-with-a-condition └── patients-with-a-condition.sql ├── 1679-shortest-subarray-to-be-removed-to-make-array-sorted └── Notes.md ├── 1850-minimum-length-of-string-after-deleting-similar-ends ├── Notes.md └── minimum-length-of-string-after-deleting-similar-ends.py ├── 1882-the-number-of-employees-which-report-to-each-employee ├── Notes.md └── the-number-of-employees-which-report-to-each-employee.sql ├── 2095-minimum-number-of-swaps-to-make-the-string-balanced └── Notes.md ├── 2223-the-number-of-rich-customers └── the-number-of-rich-customers.sql ├── 2237-longest-palindrome-by-concatenating-two-letter-words └── Notes.md ├── 231-power-of-two └── power-of-two.py ├── 2523-change-null-values-in-a-table-to-the-previous-value └── Notes.md ├── 2545-height-of-binary-tree-after-subtree-removal-queries └── Notes.md ├── 2891-maximum-beauty-of-an-array-after-applying-operation └── Notes.md ├── 3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros └── Notes.md ├── 3225-length-of-longest-subarray-with-at-most-k-frequency └── Notes.md ├── 3753-maximum-difference-between-even-and-odd-frequency-i └── Notes.md ├── 620-not-boring-movies └── not-boring-movies.sql ├── 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid └── Notes.md ├── 1715-split-a-string-into-the-max-number-of-unique-substrings └── Notes.md ├── 1819-construct-the-lexicographically-largest-valid-sequence └── Notes.md ├── 2188-minimized-maximum-of-products-distributed-to-any-store └── Notes.md ├── 2356-largest-combination-with-bitwise-and-greater-than-zero └── Notes.md ├── 2524-largest-positive-integer-that-exists-with-its-negative ├── Notes.md └── largest-positive-integer-that-exists-with-its-negative.py ├── 2614-maximum-count-of-positive-integer-and-negative-integer └── Notes.md ├── 1701-remove-max-number-of-edges-to-keep-graph-fully-traversable └── Notes.md ├── 1744-number-of-ways-to-form-a-target-string-given-a-dictionary └── Notes.md ├── 3174-minimum-number-of-changes-to-make-binary-string-beautiful └── Notes.md ├── 3219-make-lexicographically-smallest-array-by-swapping-elements └── Notes.md ├── 584-find-customer-referee └── find-customer-referee.sql ├── 1473-find-the-longest-substring-containing-vowels-in-even-counts └── Notes.md ├── 1895-minimum-number-of-operations-to-move-all-balls-to-each-box └── Notes.md ├── 2217-step-by-step-directions-from-a-binary-tree-node-to-another └── Notes.md ├── 2431-products-with-three-or-more-orders-in-two-consecutive-years └── Notes.md ├── 2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level └── Notes.md ├── 3213-count-subarrays-where-max-element-appears-at-least-k-times └── Notes.md ├── 3633-maximize-the-number-of-target-nodes-after-connecting-trees-i └── Notes.md ├── 925-construct-binary-tree-from-preorder-and-postorder-traversal └── Notes.md ├── 3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i ├── Notes.md └── minimum-operations-to-make-binary-array-elements-equal-to-one-i.py ├── 3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii └── Notes.md ├── 1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n └── Notes.md ├── 2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points └── Notes.md ├── 1616-minimum-difference-between-largest-and-smallest-value-in-three-moves └── Notes.md ├── 2864-is-object-empty └── is-object-empty.js ├── 151-reverse-words-in-a-string └── reverse-words-in-a-string.py ├── 197-rising-temperature └── rising-temperature.sql ├── 1291-immediate-food-delivery-i └── immediate-food-delivery-i.sql ├── 1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance └── Notes.md ├── 1811-fix-names-in-a-table └── fix-names-in-a-table.sql ├── 557-reverse-words-in-a-string-iii └── reverse-words-in-a-string-iii.py ├── 181-employees-earning-more-than-their-managers └── employees-earning-more-than-their-managers.sql ├── 2041-the-latest-login-in-2020 └── the-latest-login-in-2020.sql ├── 577-employee-bonus └── employee-bonus.sql ├── 2495-number-of-unique-subjects-taught-by-each-teacher └── number-of-unique-subjects-taught-by-each-teacher.sql ├── 3259-binary-tree-nodes └── binary-tree-nodes.sql ├── 1268-market-analysis-i └── market-analysis-i.sql ├── 1136-actors-and-directors-who-cooperated-at-least-three-times └── actors-and-directors-who-cooperated-at-least-three-times.sql ├── 1174-sales-analysis-iii └── sales-analysis-iii.sql ├── 570-managers-with-at-least-5-direct-reports └── managers-with-at-least-5-direct-reports.sql ├── 180-consecutive-numbers └── consecutive-numbers.sql ├── 1916-find-center-of-star-graph └── find-center-of-star-graph.py ├── 2136-find-cutoff-score-for-each-school └── find-cutoff-score-for-each-school.sql ├── 1509-replace-employee-id-with-the-unique-identifier └── replace-employee-id-with-the-unique-identifier.sql ├── 586-customer-placing-the-largest-number-of-orders └── customer-placing-the-largest-number-of-orders.sql ├── 1908-recyclable-and-low-fat-products └── recyclable-and-low-fat-products.sql ├── 595-big-countries └── big-countries.sql ├── 619-biggest-single-number └── biggest-single-number.sql ├── README.md ├── 2127-employees-whose-manager-left-the-company └── employees-whose-manager-left-the-company.sql ├── 612-shortest-distance-in-a-plane └── shortest-distance-in-a-plane.sql ├── 2024-calculate-special-bonus └── calculate-special-bonus.sql ├── 1089-remove-vowels-from-a-string └── remove-vowels-from-a-string.py ├── 1625-group-sold-products-by-the-date └── group-sold-products-by-the-date.sql ├── 2840-immediate-food-delivery-iii └── immediate-food-delivery-iii.sql ├── 2087-confirmation-rate └── confirmation-rate.sql ├── 2734-array-prototype-last └── array-prototype-last.js ├── 3160-calculate-orders-within-each-interval └── calculate-orders-within-each-interval.sql ├── 601-human-traffic-of-stadium └── human-traffic-of-stadium.sql ├── 1161-project-employees-i └── project-employees-i.sql ├── 2820-return-length-of-arguments-passed └── return-length-of-arguments-passed.js ├── 183-customers-who-never-order └── customers-who-never-order.sql ├── 1892-find-total-time-spent-by-each-employee └── find-total-time-spent-by-each-employee.sql ├── 1338-queries-quality-and-percentage └── queries-quality-and-percentage.sql ├── 1541-top-travellers └── top-travellers.sql ├── 176-second-highest-salary └── second-highest-salary.sql ├── 2809-create-hello-world-function └── create-hello-world-function.js ├── 175-combine-two-tables └── combine-two-tables.sql ├── 1390-average-selling-price └── average-selling-price.sql ├── 196-delete-duplicate-emails └── delete-duplicate-emails.sql ├── 2167-number-of-accounts-that-did-not-stream └── number-of-accounts-that-did-not-stream.sql ├── 2376-number-of-times-a-driver-was-a-passenger └── number-of-times-a-driver-was-a-passenger.sql ├── 1179-game-play-analysis-i └── game-play-analysis-i.sql ├── 1759-find-the-missing-ids └── find-the-missing-ids.sql ├── 2761-array-reduce-transformation └── array-reduce-transformation.js ├── 2746-filter-elements-from-array └── filter-elements-from-array.js ├── 602-friend-requests-ii-who-has-the-most-friends └── friend-requests-ii-who-has-the-most-friends.sql ├── 1862-count-apples-and-oranges └── count-apples-and-oranges.sql ├── 2733-sleep └── sleep.js ├── 2441-arrange-table-by-gender └── arrange-table-by-gender.sql ├── 1453-ads-performance └── ads-performance.sql ├── 2798-chunk-array └── chunk-array.js ├── 1135-customers-who-bought-all-products └── customers-who-bought-all-products.sql ├── 1462-list-the-products-ordered-in-a-period └── list-the-products-ordered-in-a-period.sql ├── 3255-pizza-toppings-cost-analysis └── pizza-toppings-cost-analysis.sql ├── 3340-snaps-analysis └── snaps-analysis.sql ├── 1225-active-businesses └── active-businesses.sql ├── 2747-apply-transform-over-each-element-in-array └── apply-transform-over-each-element-in-array.js ├── 3300-friday-purchases-i └── friday-purchases-i.sql ├── 1155-product-sales-analysis-iii └── product-sales-analysis-iii.sql ├── 3397-find-the-integer-added-to-array-i └── find-the-integer-added-to-array-i.py ├── 626-exchange-seats └── exchange-seats.sql ├── 782-jewels-and-stones └── jewels-and-stones.py ├── 3392-find-trending-hashtags └── find-trending-hashtags.sql ├── 1317-monthly-transactions-i └── monthly-transactions-i.sql ├── 3365-find-all-unique-email-domains └── find-all-unique-email-domains.sql ├── 58-length-of-last-word └── length-of-last-word.py ├── 3371-harshad-number └── harshad-number.py ├── 3481-second-day-verification └── second-day-verification.sql ├── 2571-find-the-pivot-integer └── find-the-pivot-integer.py ├── 3258-classifying-triangles-by-lengths └── classifying-triangles-by-lengths.sql ├── 3321-type-of-triangle └── type-of-triangle.py ├── 1292-immediate-food-delivery-ii └── immediate-food-delivery-ii.sql ├── 2859-add-two-promises └── add-two-promises.js ├── 1801-average-time-of-process-per-machine └── average-time-of-process-per-machine.sql ├── 2741-function-composition └── function-composition.js ├── 2885-count-occurrences-in-text └── count-occurrences-in-text.sql ├── 178-rank-scores └── rank-scores.sql ├── 2502-sort-the-people └── sort-the-people.py ├── 2837-minimum-operations-to-make-the-integer-zero └── minimum-operations-to-make-the-integer-zero.py ├── 1245-user-activity-for-the-past-30-days-i └── user-activity-for-the-past-30-days-i.sql ├── 1607-rectangles-area └── rectangles-area.sql ├── 1837-daily-leads-and-partners └── daily-leads-and-partners.sql ├── 2098-all-the-pairs-with-the-maximum-number-of-common-followers └── all-the-pairs-with-the-maximum-number-of-common-followers.sql ├── 1137-height-checker └── height-checker.py ├── 3287-loan-types └── loan-types.sql ├── 1720-crawler-log-folder └── crawler-log-folder.py ├── 3253-symmetric-coordinates └── symmetric-coordinates.sql ├── 1494-activity-participants └── activity-participants.sql ├── 1495-number-of-trusted-contacts-of-a-customer └── number-of-trusted-contacts-of-a-customer.sql ├── 1019-squares-of-a-sorted-array └── squares-of-a-sorted-array.py ├── 122-best-time-to-buy-and-sell-stock-ii └── best-time-to-buy-and-sell-stock-ii.py ├── 1448-maximum-69-number └── maximum-69-number.py ├── 2252-the-airport-with-the-most-traffic └── the-airport-with-the-most-traffic.sql ├── 2743-debounce └── debounce.js ├── 209-minimum-size-subarray-sum └── minimum-size-subarray-sum.py ├── 2789-counter-ii └── counter-ii.js ├── 350-intersection-of-two-arrays-ii └── intersection-of-two-arrays-ii.py ├── 1878-check-if-array-is-sorted-and-rotated └── check-if-array-is-sorted-and-rotated.py ├── 217-contains-duplicate └── contains-duplicate.py ├── 1224-minimum-falling-path-sum-ii └── minimum-falling-path-sum-ii.py ├── 2796-allow-one-function-call └── allow-one-function-call.js ├── 141-linked-list-cycle └── linked-list-cycle.py ├── 1415-students-and-examinations └── students-and-examinations.sql ├── 2315-the-change-in-global-rankings └── the-change-in-global-rankings.sql ├── 3422-find-the-n-th-value-after-k-seconds └── find-the-n-th-value-after-k-seconds.py ├── 2014-orders-with-maximum-quantity-above-average └── orders-with-maximum-quantity-above-average.sql ├── 1054-complement-of-base-10-integer └── complement-of-base-10-integer.py ├── 26-remove-duplicates-from-sorted-array └── remove-duplicates-from-sorted-array.py ├── 344-reverse-string └── reverse-string.py ├── 607-sales-person └── sales-person.sql ├── 2640-maximum-number-of-integers-to-choose-from-a-range-i └── maximum-number-of-integers-to-choose-from-a-range-i.py ├── 3788-maximum-unique-subarray-sum-after-deletion └── maximum-unique-subarray-sum-after-deletion.py ├── 1411-convert-binary-number-in-a-linked-list-to-integer └── convert-binary-number-in-a-linked-list-to-integer.py ├── 3195-separate-black-and-white-balls └── separate-black-and-white-balls.py ├── 359-logger-rate-limiter └── logger-rate-limiter.py ├── 3256-find-candidates-for-data-scientist-position └── find-candidates-for-data-scientist-position.sql ├── 185-department-top-three-salaries └── department-top-three-salaries.sql ├── 2451-product-sales-analysis-iv └── product-sales-analysis-iv.sql ├── 900-reordered-power-of-2 └── reordered-power-of-2.py ├── 525-contiguous-array └── contiguous-array.py ├── 614-second-degree-follower └── second-degree-follower.sql ├── 816-design-hashset └── design-hashset.py ├── 342-power-of-four └── power-of-four.py ├── 177-nth-highest-salary └── nth-highest-salary.sql ├── 3457-invalid-tweets-ii └── invalid-tweets-ii.sql ├── 2813-to-be-or-not-to-be └── to-be-or-not-to-be.js ├── 3582-find-indices-of-stable-mountains └── find-indices-of-stable-mountains.py ├── 2050-count-good-numbers └── count-good-numbers.py ├── 28-find-the-index-of-the-first-occurrence-in-a-string └── find-the-index-of-the-first-occurrence-in-a-string.py ├── 100-same-tree └── same-tree.py ├── 1426-find-n-unique-integers-sum-up-to-zero └── find-n-unique-integers-sum-up-to-zero.py ├── 1452-restaurant-growth └── restaurant-growth.sql ├── 2370-users-with-two-purchases-within-seven-days └── users-with-two-purchases-within-seven-days.sql ├── 3156-rolling-average-steps └── rolling-average-steps.sql ├── 578-get-highest-answer-rate-question └── get-highest-answer-rate-question.sql ├── 1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence └── check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.py ├── 1642-water-bottles └── water-bottles.py ├── 2057-count-salary-categories └── count-salary-categories.sql ├── 104-maximum-depth-of-binary-tree └── maximum-depth-of-binary-tree.py ├── 242-valid-anagram └── valid-anagram.py ├── 387-first-unique-character-in-a-string └── first-unique-character-in-a-string.py ├── 2030-group-employees-of-the-same-salary └── group-employees-of-the-same-salary.sql ├── 55-jump-game └── jump-game.py ├── 2097-strong-friendship └── strong-friendship.sql ├── 3515-find-if-digit-game-can-be-won └── find-if-digit-game-can-be-won.py ├── 1160-letter-tile-possibilities └── letter-tile-possibilities.py ├── 2128-reverse-prefix-of-word └── reverse-prefix-of-word.py ├── 498-diagonal-traverse └── diagonal-traverse.py ├── 1333-sort-the-jumbled-numbers └── sort-the-jumbled-numbers.py ├── 2132-convert-1d-array-into-2d-array └── convert-1d-array-into-2d-array.py ├── 3567-convert-date-to-binary └── convert-date-to-binary.py ├── 594-longest-harmonious-subsequence └── longest-harmonious-subsequence.py ├── 3283-find-third-transaction └── find-third-transaction.sql ├── 191-number-of-1-bits └── number-of-1-bits.py ├── 49-group-anagrams └── group-anagrams.py ├── 599-minimum-index-sum-of-two-lists └── minimum-index-sum-of-two-lists.py ├── 11-container-with-most-water └── container-with-most-water.py ├── 189-rotate-array └── rotate-array.py └── 2194-the-category-of-each-member-in-the-store └── the-category-of-each-member-in-the-store.sql /2732-counter/Notes.md: -------------------------------------------------------------------------------- 1 |

counter Notes


[ Time taken: 2 m 21 s ] -------------------------------------------------------------------------------- /2145-grid-game/Notes.md: -------------------------------------------------------------------------------- 1 |

grid-game Notes


[ Time taken: 32 m 47 s ] -------------------------------------------------------------------------------- /2742-group-by/Notes.md: -------------------------------------------------------------------------------- 1 |

group-by Notes


[ Time taken: 18 m 23 s ] -------------------------------------------------------------------------------- /494-target-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

target-sum Notes


[ Time taken: 4 m 23 s ] -------------------------------------------------------------------------------- /1731-even-odd-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

even-odd-tree Notes


[ Time taken: 4 m 54 s ] -------------------------------------------------------------------------------- /2509-minimize-xor/Notes.md: -------------------------------------------------------------------------------- 1 |

minimize-xor Notes


[ Time taken: 11 m 16 s ] -------------------------------------------------------------------------------- /3447-clear-digits/Notes.md: -------------------------------------------------------------------------------- 1 |

clear-digits Notes


[ Time taken: 3 m 11 s ] -------------------------------------------------------------------------------- /38-count-and-say/Notes.md: -------------------------------------------------------------------------------- 1 |

count-and-say Notes


[ Time taken: 13 m 14 s ] -------------------------------------------------------------------------------- /670-maximum-swap/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-swap Notes


[ Time taken: 12 m 22 s ] -------------------------------------------------------------------------------- /677-map-sum-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

map-sum-pairs Notes


[ Time taken: 8 m 50 s ] -------------------------------------------------------------------------------- /729-my-calendar-i/Notes.md: -------------------------------------------------------------------------------- 1 |

my-calendar-i Notes


[ Time taken: 27 m 22 s ] -------------------------------------------------------------------------------- /753-open-the-lock/Notes.md: -------------------------------------------------------------------------------- 1 |

open-the-lock Notes


[ Time taken: 15 m 20 s ] -------------------------------------------------------------------------------- /812-rotate-string/Notes.md: -------------------------------------------------------------------------------- 1 |

rotate-string Notes


[ Time taken: 1 m 35 s ] -------------------------------------------------------------------------------- /868-push-dominoes/Notes.md: -------------------------------------------------------------------------------- 1 |

push-dominoes Notes


[ Time taken: 12 m 11 s ] -------------------------------------------------------------------------------- /952-word-subsets/Notes.md: -------------------------------------------------------------------------------- 1 |

word-subsets Notes


[ Time taken: 12 m 13 s ] -------------------------------------------------------------------------------- /985-bag-of-tokens/Notes.md: -------------------------------------------------------------------------------- 1 |

bag-of-tokens Notes


[ Time taken: 18 m 30 s ] -------------------------------------------------------------------------------- /1240-stone-game-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

stone-game-ii Notes


[ Time taken: 12 m 31 s ] -------------------------------------------------------------------------------- /1583-paint-house-iii/Notes.md: -------------------------------------------------------------------------------- 1 |

paint-house-iii Notes


[ Time taken: 14 m 26 s ] -------------------------------------------------------------------------------- /1755-defuse-the-bomb/Notes.md: -------------------------------------------------------------------------------- 1 |

defuse-the-bomb Notes


[ Time taken: 14 m 35 s ] -------------------------------------------------------------------------------- /179-largest-number/Notes.md: -------------------------------------------------------------------------------- 1 |

largest-number Notes


[ Time taken: 16 m 5 s ] -------------------------------------------------------------------------------- /261-graph-valid-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

graph-valid-tree Notes


[ Time taken: 2 m 23 s ] -------------------------------------------------------------------------------- /264-ugly-number-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

ugly-number-ii Notes


[ Time taken: 5 m 37 s ] -------------------------------------------------------------------------------- /265-paint-house-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

paint-house-ii Notes


[ Time taken: 1 m 56 s ] -------------------------------------------------------------------------------- /2690-house-robber-iv/Notes.md: -------------------------------------------------------------------------------- 1 |

house-robber-iv Notes


[ Time taken: 13 m 48 s ] -------------------------------------------------------------------------------- /3257-maximize-items/Notes.md: -------------------------------------------------------------------------------- 1 |

maximize-items Notes


[ Time taken: 13 m 18 s ] -------------------------------------------------------------------------------- /330-patching-array/Notes.md: -------------------------------------------------------------------------------- 1 |

patching-array Notes


[ Time taken: 12 m 4 s ] -------------------------------------------------------------------------------- /463-island-perimeter/Notes.md: -------------------------------------------------------------------------------- 1 |

island-perimeter Notes


[ Time taken: 8 m 20 s ] -------------------------------------------------------------------------------- /621-task-scheduler/Notes.md: -------------------------------------------------------------------------------- 1 |

task-scheduler Notes


[ Time taken: 12 m 35 s ] -------------------------------------------------------------------------------- /650-2-keys-keyboard/Notes.md: -------------------------------------------------------------------------------- 1 |

2-keys-keyboard Notes


[ Time taken: 19 m 34 s ] -------------------------------------------------------------------------------- /664-strange-printer/Notes.md: -------------------------------------------------------------------------------- 1 |

strange-printer Notes


[ Time taken: 21 m 0 s ] -------------------------------------------------------------------------------- /726-number-of-atoms/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-atoms Notes


[ Time taken: 7 m 2 s ] -------------------------------------------------------------------------------- /731-my-calendar-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

my-calendar-ii Notes


[ Time taken: 22 m 43 s ] -------------------------------------------------------------------------------- /740-delete-and-earn/Notes.md: -------------------------------------------------------------------------------- 1 |

delete-and-earn Notes


[ Time taken: 17 m 11 s ] -------------------------------------------------------------------------------- /787-sliding-puzzle/Notes.md: -------------------------------------------------------------------------------- 1 |

sliding-puzzle Notes


[ Time taken: 23 m 16 s ] -------------------------------------------------------------------------------- /871-keys-and-rooms/Notes.md: -------------------------------------------------------------------------------- 1 |

keys-and-rooms Notes


[ Time taken: 5 m 21 s ] -------------------------------------------------------------------------------- /1237-reported-posts-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

reported-posts-ii Notes


[ Time taken: 30 m 4 s ] -------------------------------------------------------------------------------- /1259-article-views-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

article-views-ii Notes


[ Time taken: 2 m 43 s ] -------------------------------------------------------------------------------- /1972-rotating-the-box/Notes.md: -------------------------------------------------------------------------------- 1 |

rotating-the-box Notes


[ Time taken: 33 m 27 s ] -------------------------------------------------------------------------------- /2035-count-sub-islands/Notes.md: -------------------------------------------------------------------------------- 1 |

count-sub-islands Notes


[ Time taken: 17 m 57 s ] -------------------------------------------------------------------------------- /2089-maximum-matrix-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-matrix-sum Notes


[ Time taken: 19 m 4 s ] -------------------------------------------------------------------------------- /2411-spiral-matrix-iv/Notes.md: -------------------------------------------------------------------------------- 1 |

spiral-matrix-iv Notes


[ Time taken: 31 m 45 s ] -------------------------------------------------------------------------------- /2479-meeting-rooms-iii/Notes.md: -------------------------------------------------------------------------------- 1 |

meeting-rooms-iii Notes


[ Time taken: 28 m 35 s ] -------------------------------------------------------------------------------- /2483-task-scheduler-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

task-scheduler-ii Notes


[ Time taken: 6 m 0 s ] -------------------------------------------------------------------------------- /251-flatten-2d-vector/Notes.md: -------------------------------------------------------------------------------- 1 |

flatten-2d-vector Notes


[ Time taken: 13 m 29 s ] -------------------------------------------------------------------------------- /2580-circular-sentence/Notes.md: -------------------------------------------------------------------------------- 1 |

circular-sentence Notes


[ Time taken: 2 m 2 s ] -------------------------------------------------------------------------------- /2846-robot-collisions/Notes.md: -------------------------------------------------------------------------------- 1 |

robot-collisions Notes


[ Time taken: 42 m 13 s ] -------------------------------------------------------------------------------- /3189-find-champion-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

find-champion-ii Notes


[ Time taken: 12 m 13 s ] -------------------------------------------------------------------------------- /3394-minimum-array-end/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-array-end Notes


[ Time taken: 29 m 51 s ] -------------------------------------------------------------------------------- /476-number-complement/Notes.md: -------------------------------------------------------------------------------- 1 |

number-complement Notes


[ Time taken: 4 m 15 s ] -------------------------------------------------------------------------------- /610-triangle-judgement/Notes.md: -------------------------------------------------------------------------------- 1 |

triangle-judgement Notes


[ Time taken: 4 m 52 s ] -------------------------------------------------------------------------------- /807-custom-sort-string/Notes.md: -------------------------------------------------------------------------------- 1 |

custom-sort-string Notes


[ Time taken: 5 m 26 s ] -------------------------------------------------------------------------------- /85-maximal-rectangle/Notes.md: -------------------------------------------------------------------------------- 1 |

maximal-rectangle Notes


[ Time taken: 12 m 8 s ] -------------------------------------------------------------------------------- /1002-maximum-width-ramp/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-width-ramp Notes


[ Time taken: 17 m 17 s ] -------------------------------------------------------------------------------- /1193-game-play-analysis-v/Notes.md: -------------------------------------------------------------------------------- 1 |

game-play-analysis-v Notes


[ Time taken: 14 m 47 s ] -------------------------------------------------------------------------------- /1269-market-analysis-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

market-analysis-ii Notes


[ Time taken: 13 m 15 s ] -------------------------------------------------------------------------------- /1304-longest-happy-string/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-happy-string Notes


[ Time taken: 37 m 18 s ] -------------------------------------------------------------------------------- /1318-tournament-winners/Notes.md: -------------------------------------------------------------------------------- 1 |

tournament-winners Notes


[ Time taken: 13 m 28 s ] -------------------------------------------------------------------------------- /1500-count-largest-group/Notes.md: -------------------------------------------------------------------------------- 1 |

count-largest-group Notes


[ Time taken: 7 m 20 s ] -------------------------------------------------------------------------------- /1558-course-schedule-iv/Notes.md: -------------------------------------------------------------------------------- 1 |

course-schedule-iv Notes


[ Time taken: 11 m 27 s ] -------------------------------------------------------------------------------- /1656-count-good-triplets/Notes.md: -------------------------------------------------------------------------------- 1 |

count-good-triplets Notes


[ Time taken: 4 m 56 s ] -------------------------------------------------------------------------------- /1702-bank-account-summary/Notes.md: -------------------------------------------------------------------------------- 1 |

bank-account-summary Notes


[ Time taken: 5 m 29 s ] -------------------------------------------------------------------------------- /1876-map-of-highest-peak/Notes.md: -------------------------------------------------------------------------------- 1 |

map-of-highest-peak Notes


[ Time taken: 27 m 5 s ] -------------------------------------------------------------------------------- /214-shortest-palindrome/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-palindrome Notes


[ Time taken: 11 m 22 s ] -------------------------------------------------------------------------------- /2465-shifting-letters-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

shifting-letters-ii Notes


[ Time taken: 14 m 31 s ] -------------------------------------------------------------------------------- /2681-put-marbles-in-bags/Notes.md: -------------------------------------------------------------------------------- 1 |

put-marbles-in-bags Notes


[ Time taken: 6 m 39 s ] -------------------------------------------------------------------------------- /2868-continuous-subarrays/Notes.md: -------------------------------------------------------------------------------- 1 |

continuous-subarrays Notes


[ Time taken: 35 m 6 s ] -------------------------------------------------------------------------------- /3288-top-three-wineries/Notes.md: -------------------------------------------------------------------------------- 1 |

top-three-wineries Notes


[ Time taken: 15 m 39 s ] -------------------------------------------------------------------------------- /3301-friday-purchases-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

friday-purchases-ii Notes


[ Time taken: 4 m 53 s ] -------------------------------------------------------------------------------- /3400-find-bursty-behavior/Notes.md: -------------------------------------------------------------------------------- 1 |

find-bursty-behavior Notes


[ Time taken: 10 m 45 s ] -------------------------------------------------------------------------------- /633-sum-of-square-numbers/Notes.md: -------------------------------------------------------------------------------- 1 |

sum-of-square-numbers Notes


[ Time taken: 5 m 24 s ] -------------------------------------------------------------------------------- /684-redundant-connection/Notes.md: -------------------------------------------------------------------------------- 1 |

redundant-connection Notes


[ Time taken: 7 m 0 s ] -------------------------------------------------------------------------------- /859-design-circular-deque/Notes.md: -------------------------------------------------------------------------------- 1 |

design-circular-deque Notes


[ Time taken: 7 m 27 s ] -------------------------------------------------------------------------------- /1044-find-common-characters/Notes.md: -------------------------------------------------------------------------------- 1 |

find-common-characters Notes


[ Time taken: 6 m 40 s ] -------------------------------------------------------------------------------- /1063-best-sightseeing-pair/Notes.md: -------------------------------------------------------------------------------- 1 |

best-sightseeing-pair Notes


[ Time taken: 9 m 57 s ] -------------------------------------------------------------------------------- /1226-user-purchase-platform/Notes.md: -------------------------------------------------------------------------------- 1 |

user-purchase-platform Notes


[ Time taken: 28 m 21 s ] -------------------------------------------------------------------------------- /1236-n-th-tribonacci-number/Notes.md: -------------------------------------------------------------------------------- 1 |

n-th-tribonacci-number Notes


[ Time taken: 1 m 20 s ] -------------------------------------------------------------------------------- /1511-count-number-of-teams/Notes.md: -------------------------------------------------------------------------------- 1 |

count-number-of-teams Notes


[ Time taken: 10 m 14 s ] -------------------------------------------------------------------------------- /165-compare-version-numbers/Notes.md: -------------------------------------------------------------------------------- 1 |

compare-version-numbers Notes


[ Time taken: 7 m 31 s ] -------------------------------------------------------------------------------- /1666-make-the-string-great/Notes.md: -------------------------------------------------------------------------------- 1 |

make-the-string-great Notes


[ Time taken: 3 m 53 s ] -------------------------------------------------------------------------------- /2046-page-recommendations-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

page-recommendations-ii Notes


[ Time taken: 10 m 4 s ] -------------------------------------------------------------------------------- /220-contains-duplicate-iii/Notes.md: -------------------------------------------------------------------------------- 1 |

contains-duplicate-iii Notes


[ Time taken: 21 m 32 s ] -------------------------------------------------------------------------------- /234-palindrome-linked-list/Notes.md: -------------------------------------------------------------------------------- 1 |

palindrome-linked-list Notes


[ Time taken: 2 m 49 s ] -------------------------------------------------------------------------------- /2478-longest-nice-subarray/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-nice-subarray Notes


[ Time taken: 16 m 22 s ] -------------------------------------------------------------------------------- /2792-neighboring-bitwise-xor/Notes.md: -------------------------------------------------------------------------------- 1 |

neighboring-bitwise-xor Notes


[ Time taken: 8 m 44 s ] -------------------------------------------------------------------------------- /3483-alternating-groups-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

alternating-groups-ii Notes


[ Time taken: 11 m 34 s ] -------------------------------------------------------------------------------- /386-lexicographical-numbers/Notes.md: -------------------------------------------------------------------------------- 1 |

lexicographical-numbers Notes


[ Time taken: 8 m 9 s ] -------------------------------------------------------------------------------- /407-trapping-rain-water-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

trapping-rain-water-ii Notes


[ Time taken: 7 m 20 s ] -------------------------------------------------------------------------------- /410-split-array-largest-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

split-array-largest-sum Notes


[ Time taken: 7 m 57 s ] -------------------------------------------------------------------------------- /432-all-oone-data-structure/Notes.md: -------------------------------------------------------------------------------- 1 |

all-oone-data-structure Notes


[ Time taken: 21 m 43 s ] -------------------------------------------------------------------------------- /523-continuous-subarray-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

continuous-subarray-sum Notes


[ Time taken: 23 m 22 s ] -------------------------------------------------------------------------------- /539-minimum-time-difference/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-time-difference Notes


[ Time taken: 8 m 29 s ] -------------------------------------------------------------------------------- /567-permutation-in-string/Notes.md: -------------------------------------------------------------------------------- 1 |

permutation-in-string Notes


[ Time taken: 13 m 37 s ] -------------------------------------------------------------------------------- /569-median-employee-salary/Notes.md: -------------------------------------------------------------------------------- 1 |

median-employee-salary Notes


[ Time taken: 13 m 24 s ] -------------------------------------------------------------------------------- /1025-minimum-cost-for-tickets/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-cost-for-tickets Notes


[ Time taken: 7 m 19 s ] -------------------------------------------------------------------------------- /1196-filling-bookcase-shelves/Notes.md: -------------------------------------------------------------------------------- 1 |

filling-bookcase-shelves Notes


[ Time taken: 20 m 8 s ] -------------------------------------------------------------------------------- /1301-reformat-department-table/Notes.md: -------------------------------------------------------------------------------- 1 |

reformat-department-table Notes


[ Time taken: 10 m 33 s ] -------------------------------------------------------------------------------- /1435-xor-queries-of-a-subarray/Notes.md: -------------------------------------------------------------------------------- 1 |

xor-queries-of-a-subarray Notes


[ Time taken: 4 m 31 s ] -------------------------------------------------------------------------------- /1694-make-sum-divisible-by-p/Notes.md: -------------------------------------------------------------------------------- 1 |

make-sum-divisible-by-p Notes


[ Time taken: 1 hr 25 m 5 s ] -------------------------------------------------------------------------------- /1779-hopper-company-queries-i/Notes.md: -------------------------------------------------------------------------------- 1 |

hopper-company-queries-i Notes


[ Time taken: 8 m 2 s ] -------------------------------------------------------------------------------- /1923-sentence-similarity-iii/Notes.md: -------------------------------------------------------------------------------- 1 |

sentence-similarity-iii Notes


[ Time taken: 11 m 31 s ] -------------------------------------------------------------------------------- /2155-find-missing-observations/Notes.md: -------------------------------------------------------------------------------- 1 |

find-missing-observations Notes


[ Time taken: 16 m 48 s ] -------------------------------------------------------------------------------- /2232-adding-spaces-to-a-string/Notes.md: -------------------------------------------------------------------------------- 1 |

adding-spaces-to-a-string Notes


[ Time taken: 5 m 2 s ] -------------------------------------------------------------------------------- /2444-longest-ideal-subsequence/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-ideal-subsequence Notes


[ Time taken: 32 m 26 s ] -------------------------------------------------------------------------------- /2448-count-number-of-bad-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

count-number-of-bad-pairs Notes


[ Time taken: 16 m 10 s ] -------------------------------------------------------------------------------- /2677-cousins-in-binary-tree-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

cousins-in-binary-tree-ii Notes


[ Time taken: 21 m 58 s ] -------------------------------------------------------------------------------- /287-find-the-duplicate-number/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-duplicate-number Notes


[ Time taken: 2 m 33 s ] -------------------------------------------------------------------------------- /2998-count-symmetric-integers/Notes.md: -------------------------------------------------------------------------------- 1 |

count-symmetric-integers Notes


[ Time taken: 5 m 10 s ] -------------------------------------------------------------------------------- /3055-maximum-odd-binary-number/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-odd-binary-number Notes


[ Time taken: 7 m 29 s ] -------------------------------------------------------------------------------- /3302-viewers-turned-streamers/Notes.md: -------------------------------------------------------------------------------- 1 |

viewers-turned-streamers Notes


[ Time taken: 7 m 42 s ] -------------------------------------------------------------------------------- /3488-find-top-scoring-students/Notes.md: -------------------------------------------------------------------------------- 1 |

find-top-scoring-students Notes


[ Time taken: 12 m 50 s ] -------------------------------------------------------------------------------- /3530-odd-and-even-transactions/Notes.md: -------------------------------------------------------------------------------- 1 |

odd-and-even-transactions Notes


[ Time taken: 3 m 46 s ] -------------------------------------------------------------------------------- /3549-ceo-subordinate-hierarchy/Notes.md: -------------------------------------------------------------------------------- 1 |

ceo-subordinate-hierarchy Notes


[ Time taken: 4 m 28 s ] -------------------------------------------------------------------------------- /368-largest-divisible-subset/Notes.md: -------------------------------------------------------------------------------- 1 |

largest-divisible-subset Notes


[ Time taken: 13 m 41 s ] -------------------------------------------------------------------------------- /678-valid-parenthesis-string/Notes.md: -------------------------------------------------------------------------------- 1 |

valid-parenthesis-string Notes


[ Time taken: 12 m 17 s ] -------------------------------------------------------------------------------- /780-max-chunks-to-make-sorted/Notes.md: -------------------------------------------------------------------------------- 1 |

max-chunks-to-make-sorted Notes


[ Time taken: 10 m 12 s ] -------------------------------------------------------------------------------- /820-find-eventual-safe-states/Notes.md: -------------------------------------------------------------------------------- 1 |

find-eventual-safe-states Notes


[ Time taken: 12 m 42 s ] -------------------------------------------------------------------------------- /863-sum-of-distances-in-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

sum-of-distances-in-tree Notes


[ Time taken: 29 m 15 s ] -------------------------------------------------------------------------------- /906-walking-robot-simulation/Notes.md: -------------------------------------------------------------------------------- 1 |

walking-robot-simulation Notes


[ Time taken: 7 m 17 s ] -------------------------------------------------------------------------------- /966-binary-subarrays-with-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

binary-subarrays-with-sum Notes


[ Time taken: 5 m 49 s ] -------------------------------------------------------------------------------- /1256-rank-transform-of-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

rank-transform-of-an-array Notes


[ Time taken: 4 m 42 s ] -------------------------------------------------------------------------------- /1484-linked-list-in-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

linked-list-in-binary-tree Notes


[ Time taken: 27 m 54 s ] -------------------------------------------------------------------------------- /1518-total-sales-amount-by-year/Notes.md: -------------------------------------------------------------------------------- 1 |

total-sales-amount-by-year Notes


[ Time taken: 6 m 44 s ] -------------------------------------------------------------------------------- /1524-string-matching-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

string-matching-in-an-array Notes


[ Time taken: 6 m 11 s ] -------------------------------------------------------------------------------- /1795-hopper-company-queries-iii/Notes.md: -------------------------------------------------------------------------------- 1 |

hopper-company-queries-iii Notes


[ Time taken: 14 m 24 s ] -------------------------------------------------------------------------------- /1917-maximum-average-pass-ratio/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-average-pass-ratio Notes


[ Time taken: 17 m 4 s ] -------------------------------------------------------------------------------- /1940-maximum-xor-for-each-query/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-xor-for-each-query Notes


[ Time taken: 15 m 39 s ] -------------------------------------------------------------------------------- /2048-build-array-from-permutation/Notes.md: -------------------------------------------------------------------------------- 1 |

build-array-from-permutation Notes


[ Time taken: 2 m 1 s ] -------------------------------------------------------------------------------- /2103-find-all-groups-of-farmland/Notes.md: -------------------------------------------------------------------------------- 1 |

find-all-groups-of-farmland Notes


[ Time taken: 14 m 13 s ] -------------------------------------------------------------------------------- /2201-valid-arrangement-of-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

valid-arrangement-of-pairs Notes


[ Time taken: 25 m 19 s ] -------------------------------------------------------------------------------- /2215-finding-3-digit-even-numbers/Notes.md: -------------------------------------------------------------------------------- 1 |

finding-3-digit-even-numbers Notes


[ Time taken: 8 m 4 s ] -------------------------------------------------------------------------------- /2249-count-the-hidden-sequences/Notes.md: -------------------------------------------------------------------------------- 1 |

count-the-hidden-sequences Notes


[ Time taken: 7 m 30 s ] -------------------------------------------------------------------------------- /2299-merge-nodes-in-between-zeros/Notes.md: -------------------------------------------------------------------------------- 1 |

merge-nodes-in-between-zeros Notes


[ Time taken: 5 m 15 s ] -------------------------------------------------------------------------------- /2381-dynamic-pivoting-of-a-table/Notes.md: -------------------------------------------------------------------------------- 1 |

dynamic-pivoting-of-a-table Notes


[ Time taken: 3 m 52 s ] -------------------------------------------------------------------------------- /2533-bitwise-xor-of-all-pairings/Notes.md: -------------------------------------------------------------------------------- 1 |

bitwise-xor-of-all-pairings Notes


[ Time taken: 4 m 51 s ] -------------------------------------------------------------------------------- /2551-apply-operations-to-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

apply-operations-to-an-array Notes


[ Time taken: 3 m 41 s ] -------------------------------------------------------------------------------- /2665-minimum-time-to-repair-cars/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-time-to-repair-cars Notes


[ Time taken: 10 m 28 s ] -------------------------------------------------------------------------------- /2716-prime-subtraction-operation/Notes.md: -------------------------------------------------------------------------------- 1 |

prime-subtraction-operation Notes


[ Time taken: 17 m 33 s ] -------------------------------------------------------------------------------- /2755-extra-characters-in-a-string/Notes.md: -------------------------------------------------------------------------------- 1 |

extra-characters-in-a-string Notes


[ Time taken: 7 m 23 s ] -------------------------------------------------------------------------------- /3291-find-if-array-can-be-sorted/Notes.md: -------------------------------------------------------------------------------- 1 |

find-if-array-can-be-sorted Notes


[ Time taken: 20 m 36 s ] -------------------------------------------------------------------------------- /3430-count-days-without-meetings/Notes.md: -------------------------------------------------------------------------------- 1 |

count-days-without-meetings Notes


[ Time taken: 3 m 27 s ] -------------------------------------------------------------------------------- /3585-find-overlapping-shifts-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

find-overlapping-shifts-ii Notes


[ Time taken: 14 m 38 s ] -------------------------------------------------------------------------------- /3639-zero-array-transformation-i/Notes.md: -------------------------------------------------------------------------------- 1 |

zero-array-transformation-i Notes


[ Time taken: 4 m 29 s ] -------------------------------------------------------------------------------- /3643-zero-array-transformation-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

zero-array-transformation-ii Notes


[ Time taken: 7 m 3 s ] -------------------------------------------------------------------------------- /3767-find-students-who-improved/Notes.md: -------------------------------------------------------------------------------- 1 |

find-students-who-improved Notes


[ Time taken: 8 m 35 s ] -------------------------------------------------------------------------------- /513-find-bottom-left-tree-value/Notes.md: -------------------------------------------------------------------------------- 1 |

find-bottom-left-tree-value Notes


[ Time taken: 4 m 19 s ] -------------------------------------------------------------------------------- /538-convert-bst-to-greater-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

convert-bst-to-greater-tree Notes


[ Time taken: 3 m 42 s ] -------------------------------------------------------------------------------- /552-student-attendance-record-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

student-attendance-record-ii Notes


[ Time taken: 22 m 25 s ] -------------------------------------------------------------------------------- /564-find-the-closest-palindrome/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-closest-palindrome Notes


[ Time taken: 6 m 33 s ] -------------------------------------------------------------------------------- /624-maximum-distance-in-arrays/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-distance-in-arrays Notes


[ Time taken: 15 m 37 s ] -------------------------------------------------------------------------------- /802-k-th-smallest-prime-fraction/Notes.md: -------------------------------------------------------------------------------- 1 |

k-th-smallest-prime-fraction Notes


[ Time taken: 28 m 2 s ] -------------------------------------------------------------------------------- /853-most-profit-assigning-work/Notes.md: -------------------------------------------------------------------------------- 1 |

most-profit-assigning-work Notes


[ Time taken: 18 m 22 s ] -------------------------------------------------------------------------------- /891-score-after-flipping-matrix/Notes.md: -------------------------------------------------------------------------------- 1 |

score-after-flipping-matrix Notes


[ Time taken: 17 m 28 s ] -------------------------------------------------------------------------------- /988-flip-equivalent-binary-trees/Notes.md: -------------------------------------------------------------------------------- 1 |

flip-equivalent-binary-trees Notes


[ Time taken: 10 m 55 s ] -------------------------------------------------------------------------------- /1021-distribute-coins-in-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

distribute-coins-in-binary-tree Notes


[ Time taken: 9 m 5 s ] -------------------------------------------------------------------------------- /1171-shortest-path-in-binary-matrix/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-path-in-binary-matrix Notes


[ Time taken: 8 m 30 s ] -------------------------------------------------------------------------------- /1197-parsing-a-boolean-expression/Notes.md: -------------------------------------------------------------------------------- 1 |

parsing-a-boolean-expression Notes


[ Time taken: 14 m 15 s ] -------------------------------------------------------------------------------- /1285-balance-a-binary-search-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

balance-a-binary-search-tree Notes


[ Time taken: 15 m 25 s ] -------------------------------------------------------------------------------- /1325-path-with-maximum-probability/Notes.md: -------------------------------------------------------------------------------- 1 |

path-with-maximum-probability Notes


[ Time taken: 14 m 23 s ] -------------------------------------------------------------------------------- /1370-count-number-of-nice-subarrays/Notes.md: -------------------------------------------------------------------------------- 1 |

count-number-of-nice-subarrays Notes


[ Time taken: 18 m 33 s ] -------------------------------------------------------------------------------- /1396-count-servers-that-communicate/Notes.md: -------------------------------------------------------------------------------- 1 |

count-servers-that-communicate Notes


[ Time taken: 9 m 39 s ] -------------------------------------------------------------------------------- /1477-product-of-the-last-k-numbers/Notes.md: -------------------------------------------------------------------------------- 1 |

product-of-the-last-k-numbers Notes


[ Time taken: 17 m 53 s ] -------------------------------------------------------------------------------- /1502-construct-k-palindrome-strings/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-k-palindrome-strings Notes


[ Time taken: 10 m 59 s ] -------------------------------------------------------------------------------- /1510-find-lucky-integer-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

find-lucky-integer-in-an-array Notes


[ Time taken: 1 m 38 s ] -------------------------------------------------------------------------------- /1927-maximum-ascending-subarray-sum/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-ascending-subarray-sum Notes


[ Time taken: 2 m 42 s ] -------------------------------------------------------------------------------- /1993-sum-of-all-subset-xor-totals/Notes.md: -------------------------------------------------------------------------------- 1 |

sum-of-all-subset-xor-totals Notes


[ Time taken: 11 m 33 s ] -------------------------------------------------------------------------------- /2308-divide-array-into-equal-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

divide-array-into-equal-pairs Notes


[ Time taken: 1 m 26 s ] -------------------------------------------------------------------------------- /2335-finding-the-topic-of-each-post/Notes.md: -------------------------------------------------------------------------------- 1 |

finding-the-topic-of-each-post Notes


[ Time taken: 5 m 22 s ] -------------------------------------------------------------------------------- /2358-number-of-ways-to-split-array/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-ways-to-split-array Notes


[ Time taken: 3 m 33 s ] -------------------------------------------------------------------------------- /2414-move-pieces-to-obtain-a-string/Notes.md: -------------------------------------------------------------------------------- 1 |

move-pieces-to-obtain-a-string Notes


[ Time taken: 22 m 0 s ] -------------------------------------------------------------------------------- /2472-build-a-matrix-with-conditions/Notes.md: -------------------------------------------------------------------------------- 1 |

build-a-matrix-with-conditions Notes


[ Time taken: 8 m 56 s ] -------------------------------------------------------------------------------- /2564-most-profitable-path-in-a-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

most-profitable-path-in-a-tree Notes


[ Time taken: 7 m 2 s ] -------------------------------------------------------------------------------- /2573-remove-nodes-from-linked-list/Notes.md: -------------------------------------------------------------------------------- 1 |

remove-nodes-from-linked-list Notes


[ Time taken: 10 m 31 s ] -------------------------------------------------------------------------------- /2691-count-vowel-strings-in-ranges/Notes.md: -------------------------------------------------------------------------------- 1 |

count-vowel-strings-in-ranges Notes


[ Time taken: 13 m 55 s ] -------------------------------------------------------------------------------- /2699-count-the-number-of-fair-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

count-the-number-of-fair-pairs Notes


[ Time taken: 20 m 8 s ] -------------------------------------------------------------------------------- /2888-minimum-index-of-a-valid-split/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-index-of-a-valid-split Notes


[ Time taken: 11 m 58 s ] -------------------------------------------------------------------------------- /2914-find-the-safest-path-in-a-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-safest-path-in-a-grid Notes


[ Time taken: 50 m 16 s ] -------------------------------------------------------------------------------- /2915-count-of-interesting-subarrays/Notes.md: -------------------------------------------------------------------------------- 1 |

count-of-interesting-subarrays Notes


[ Time taken: 6 m 51 s ] -------------------------------------------------------------------------------- /3194-find-words-containing-character/Notes.md: -------------------------------------------------------------------------------- 1 |

find-words-containing-character Notes


[ Time taken: 1 m 0 s ] -------------------------------------------------------------------------------- /334-increasing-triplet-subsequence/Notes.md: -------------------------------------------------------------------------------- 1 |

increasing-triplet-subsequence Notes


[ Time taken: 19 m 19 s ] -------------------------------------------------------------------------------- /3358-friends-with-no-mutual-friends/Notes.md: -------------------------------------------------------------------------------- 1 |

friends-with-no-mutual-friends Notes


[ Time taken: 22 m 17 s ] -------------------------------------------------------------------------------- /3369-calculate-trapping-rain-water/Notes.md: -------------------------------------------------------------------------------- 1 |

calculate-trapping-rain-water Notes


[ Time taken: 2 m 59 s ] -------------------------------------------------------------------------------- /3448-consecutive-available-seats-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

consecutive-available-seats-ii Notes


[ Time taken: 9 m 51 s ] -------------------------------------------------------------------------------- /887-minimum-cost-to-hire-k-workers/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-cost-to-hire-k-workers Notes


[ Time taken: 37 m 13 s ] -------------------------------------------------------------------------------- /1227-number-of-equivalent-domino-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-equivalent-domino-pairs Notes


[ Time taken: 3 m 59 s ] -------------------------------------------------------------------------------- /1450-delete-leaves-with-a-given-value/Notes.md: -------------------------------------------------------------------------------- 1 |

delete-leaves-with-a-given-value Notes


[ Time taken: 9 m 54 s ] -------------------------------------------------------------------------------- /1468-check-if-n-and-its-double-exist/Notes.md: -------------------------------------------------------------------------------- 1 |

check-if-n-and-its-double-exist Notes


[ Time taken: 2 m 40 s ] -------------------------------------------------------------------------------- /1615-range-sum-of-sorted-subarray-sums/Notes.md: -------------------------------------------------------------------------------- 1 |

range-sum-of-sorted-subarray-sums Notes


[ Time taken: 8 m 17 s ] -------------------------------------------------------------------------------- /1653-number-of-good-leaf-nodes-pairs/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-good-leaf-nodes-pairs Notes


[ Time taken: 26 m 38 s ] -------------------------------------------------------------------------------- /182-duplicate-emails/duplicate-emails.sql: -------------------------------------------------------------------------------- 1 | SELECT email 2 | FROM person 3 | GROUP BY email 4 | HAVING COUNT(email) > 1; 5 | -------------------------------------------------------------------------------- /1886-minimum-limit-of-balls-in-a-bag/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-limit-of-balls-in-a-bag Notes


[ Time taken: 15 m 15 s ] -------------------------------------------------------------------------------- /2143-count-the-number-of-experiments/Notes.md: -------------------------------------------------------------------------------- 1 |

count-the-number-of-experiments Notes


[ Time taken: 6 m 53 s ] -------------------------------------------------------------------------------- /2163-kth-distinct-string-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

kth-distinct-string-in-an-array Notes


[ Time taken: 4 m 21 s ] -------------------------------------------------------------------------------- /2164-two-best-non-overlapping-events/Notes.md: -------------------------------------------------------------------------------- 1 |

two-best-non-overlapping-events Notes


[ Time taken: 21 m 41 s ] -------------------------------------------------------------------------------- /2379-maximum-total-importance-of-roads/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-total-importance-of-roads Notes


[ Time taken: 9 m 5 s ] -------------------------------------------------------------------------------- /241-different-ways-to-add-parentheses/Notes.md: -------------------------------------------------------------------------------- 1 |

different-ways-to-add-parentheses Notes


[ Time taken: 7 m 28 s ] -------------------------------------------------------------------------------- /2434-design-a-number-container-system/Notes.md: -------------------------------------------------------------------------------- 1 |

design-a-number-container-system Notes


[ Time taken: 5 m 8 s ] -------------------------------------------------------------------------------- /2484-compute-the-rank-as-a-percentage/Notes.md: -------------------------------------------------------------------------------- 1 |

compute-the-rank-as-a-percentage Notes


[ Time taken: 5 m 46 s ] -------------------------------------------------------------------------------- /2494-sum-of-prefix-scores-of-strings/Notes.md: -------------------------------------------------------------------------------- 1 |

sum-of-prefix-scores-of-strings Notes


[ Time taken: 9 m 20 s ] -------------------------------------------------------------------------------- /2554-minimum-total-distance-traveled/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-total-distance-traveled Notes


[ Time taken: 24 m 11 s ] -------------------------------------------------------------------------------- /2562-count-ways-to-build-good-strings/Notes.md: -------------------------------------------------------------------------------- 1 |

count-ways-to-build-good-strings Notes


[ Time taken: 12 m 3 s ] -------------------------------------------------------------------------------- /2586-longest-square-streak-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-square-streak-in-an-array Notes


[ Time taken: 6 m 39 s ] -------------------------------------------------------------------------------- /2646-kth-largest-sum-in-a-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

kth-largest-sum-in-a-binary-tree Notes


[ Time taken: 6 m 45 s ] -------------------------------------------------------------------------------- /2674-make-the-prefix-sum-non-negative/Notes.md: -------------------------------------------------------------------------------- 1 |

make-the-prefix-sum-non-negative Notes


[ Time taken: 7 m 12 s ] -------------------------------------------------------------------------------- /2692-take-gifts-from-the-richest-pile/Notes.md: -------------------------------------------------------------------------------- 1 |

take-gifts-from-the-richest-pile Notes


[ Time taken: 4 m 35 s ] -------------------------------------------------------------------------------- /2696-the-number-of-beautiful-subsets/Notes.md: -------------------------------------------------------------------------------- 1 |

the-number-of-beautiful-subsets Notes


[ Time taken: 11 m 8 s ] -------------------------------------------------------------------------------- /270-closest-binary-search-tree-value/Notes.md: -------------------------------------------------------------------------------- 1 |

closest-binary-search-tree-value Notes


[ Time taken: 9 m 14 s ] -------------------------------------------------------------------------------- /2764-maximum-number-of-fish-in-a-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-number-of-fish-in-a-grid Notes


[ Time taken: 8 m 49 s ] -------------------------------------------------------------------------------- /3227-find-missing-and-repeated-values/Notes.md: -------------------------------------------------------------------------------- 1 |

find-missing-and-repeated-values Notes


[ Time taken: 2 m 57 s ] -------------------------------------------------------------------------------- /3235-minimum-cost-to-convert-string-i/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-cost-to-convert-string-i Notes


[ Time taken: 14 m 8 s ] -------------------------------------------------------------------------------- /3309-count-prefix-and-suffix-pairs-i/Notes.md: -------------------------------------------------------------------------------- 1 |

count-prefix-and-suffix-pairs-i Notes


[ Time taken: 6 m 33 s ] -------------------------------------------------------------------------------- /3617-find-the-original-typed-string-i/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-original-typed-string-i Notes


[ Time taken: 4 m 50 s ] -------------------------------------------------------------------------------- /592-fraction-addition-and-subtraction/Notes.md: -------------------------------------------------------------------------------- 1 |

fraction-addition-and-subtraction Notes


[ Time taken: 7 m 18 s ] -------------------------------------------------------------------------------- /759-set-intersection-size-at-least-two/Notes.md: -------------------------------------------------------------------------------- 1 |

set-intersection-size-at-least-two Notes


[ Time taken: 6 m 5 s ] -------------------------------------------------------------------------------- /920-uncommon-words-from-two-sentences/Notes.md: -------------------------------------------------------------------------------- 1 |

uncommon-words-from-two-sentences Notes


[ Time taken: 4 m 21 s ] -------------------------------------------------------------------------------- /1034-subarrays-with-k-different-integers/Notes.md: -------------------------------------------------------------------------------- 1 |

subarrays-with-k-different-integers Notes


[ Time taken: 24 m 27 s ] -------------------------------------------------------------------------------- /1321-get-equal-substrings-within-budget/Notes.md: -------------------------------------------------------------------------------- 1 |

get-equal-substrings-within-budget Notes


[ Time taken: 6 m 0 s ] -------------------------------------------------------------------------------- /1667-find-kth-bit-in-nth-binary-string/Notes.md: -------------------------------------------------------------------------------- 1 |

find-kth-bit-in-nth-binary-string Notes


[ Time taken: 10 m 54 s ] -------------------------------------------------------------------------------- /1741-sort-array-by-increasing-frequency/Notes.md: -------------------------------------------------------------------------------- 1 |

sort-array-by-increasing-frequency Notes


[ Time taken: 2 m 38 s ] -------------------------------------------------------------------------------- /1827-invalid-tweets/invalid-tweets.sql: -------------------------------------------------------------------------------- 1 | SELECT tweet_id 2 | FROM Tweets 3 | WHERE LENGTH(content) > 15 4 | ORDER BY tweet_id; 5 | -------------------------------------------------------------------------------- /1942-primary-department-for-each-employee/Notes.md: -------------------------------------------------------------------------------- 1 |

primary-department-for-each-employee Notes


[ Time taken: 4 m 0 s ] -------------------------------------------------------------------------------- /1951-find-the-winner-of-the-circular-game/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-winner-of-the-circular-game Notes


[ Time taken: 6 m 0 s ] -------------------------------------------------------------------------------- /2067-maximum-number-of-points-with-cost/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-number-of-points-with-cost Notes


[ Time taken: 12 m 22 s ] -------------------------------------------------------------------------------- /2120-first-and-last-call-on-the-same-day/Notes.md: -------------------------------------------------------------------------------- 1 |

first-and-last-call-on-the-same-day Notes


[ Time taken: 22 m 19 s ] -------------------------------------------------------------------------------- /2179-most-beautiful-item-for-each-query/Notes.md: -------------------------------------------------------------------------------- 1 |

most-beautiful-item-for-each-query Notes


[ Time taken: 12 m 48 s ] -------------------------------------------------------------------------------- /2262-solving-questions-with-brainpower/Notes.md: -------------------------------------------------------------------------------- 1 |

solving-questions-with-brainpower Notes


[ Time taken: 13 m 12 s ] -------------------------------------------------------------------------------- /2292-counting-words-with-a-given-prefix/Notes.md: -------------------------------------------------------------------------------- 1 |

counting-words-with-a-given-prefix Notes


[ Time taken: 2 m 23 s ] -------------------------------------------------------------------------------- /2300-construct-string-with-repeat-limit/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-string-with-repeat-limit Notes


[ Time taken: 3 m 7 s ] -------------------------------------------------------------------------------- /2343-count-unguarded-cells-in-the-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

count-unguarded-cells-in-the-grid Notes


[ Time taken: 14 m 33 s ] -------------------------------------------------------------------------------- /2493-reverse-odd-levels-of-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

reverse-odd-levels-of-binary-tree Notes


[ Time taken: 12 m 44 s ] -------------------------------------------------------------------------------- /2527-count-subarrays-with-fixed-bounds/Notes.md: -------------------------------------------------------------------------------- 1 |

count-subarrays-with-fixed-bounds Notes


[ Time taken: 34 m 16 s ] -------------------------------------------------------------------------------- /2649-count-total-number-of-colored-cells/Notes.md: -------------------------------------------------------------------------------- 1 |

count-total-number-of-colored-cells Notes


[ Time taken: 5 m 52 s ] -------------------------------------------------------------------------------- /2794-maximum-number-of-moves-in-a-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-number-of-moves-in-a-grid Notes


[ Time taken: 15 m 31 s ] -------------------------------------------------------------------------------- /3307-find-the-maximum-sum-of-node-values/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-maximum-sum-of-node-values Notes


[ Time taken: 20 m 10 s ] -------------------------------------------------------------------------------- /3473-calculate-parking-fees-and-duration/Notes.md: -------------------------------------------------------------------------------- 1 |

calculate-parking-fees-and-duration Notes


[ Time taken: 13 m 13 s ] -------------------------------------------------------------------------------- /515-find-largest-value-in-each-tree-row/Notes.md: -------------------------------------------------------------------------------- 1 |

find-largest-value-in-each-tree-row Notes


[ Time taken: 1 m 51 s ] -------------------------------------------------------------------------------- /580-count-student-number-in-departments/Notes.md: -------------------------------------------------------------------------------- 1 |

count-student-number-in-departments Notes


[ Time taken: 2 m 43 s ] -------------------------------------------------------------------------------- /718-maximum-length-of-repeated-subarray/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-length-of-repeated-subarray Notes


[ Time taken: 4 m 6 s ] -------------------------------------------------------------------------------- /1093-recover-a-tree-from-preorder-traversal/Notes.md: -------------------------------------------------------------------------------- 1 |

recover-a-tree-from-preorder-traversal Notes


[ Time taken: 9 m 2 s ] -------------------------------------------------------------------------------- /1302-delete-characters-to-make-fancy-string/Notes.md: -------------------------------------------------------------------------------- 1 |

delete-characters-to-make-fancy-string Notes


[ Time taken: 3 m 46 s ] -------------------------------------------------------------------------------- /1350-remove-sub-folders-from-the-filesystem/Notes.md: -------------------------------------------------------------------------------- 1 |

remove-sub-folders-from-the-filesystem Notes


[ Time taken: 8 m 59 s ] -------------------------------------------------------------------------------- /1402-count-square-submatrices-with-all-ones/Notes.md: -------------------------------------------------------------------------------- 1 |

count-square-submatrices-with-all-ones Notes


[ Time taken: 9 m 19 s ] -------------------------------------------------------------------------------- /154-find-minimum-in-rotated-sorted-array-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

find-minimum-in-rotated-sorted-array-ii Notes


[ Time taken: 34 s ] -------------------------------------------------------------------------------- /1849-maximum-absolute-sum-of-any-subarray/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-absolute-sum-of-any-subarray Notes


[ Time taken: 10 m 54 s ] -------------------------------------------------------------------------------- /2021-remove-all-occurrences-of-a-substring/Notes.md: -------------------------------------------------------------------------------- 1 |

remove-all-occurrences-of-a-substring Notes


[ Time taken: 9 m 18 s ] -------------------------------------------------------------------------------- /2281-the-number-of-passengers-in-each-bus-i/Notes.md: -------------------------------------------------------------------------------- 1 |

the-number-of-passengers-in-each-bus-i Notes


[ Time taken: 9 m 54 s ] -------------------------------------------------------------------------------- /2306-create-binary-tree-from-descriptions/Notes.md: -------------------------------------------------------------------------------- 1 |

create-binary-tree-from-descriptions Notes


[ Time taken: 7 m 21 s ] -------------------------------------------------------------------------------- /2394-count-subarrays-with-score-less-than-k/Notes.md: -------------------------------------------------------------------------------- 1 |

count-subarrays-with-score-less-than-k Notes


[ Time taken: 7 m 36 s ] -------------------------------------------------------------------------------- /2438-find-closest-node-to-given-two-nodes/Notes.md: -------------------------------------------------------------------------------- 1 |

find-closest-node-to-given-two-nodes Notes


[ Time taken: 13 m 1 s ] -------------------------------------------------------------------------------- /2685-first-completely-painted-row-or-column/Notes.md: -------------------------------------------------------------------------------- 1 |

first-completely-painted-row-or-column Notes


[ Time taken: 8 m 41 s ] -------------------------------------------------------------------------------- /2707-merge-two-2d-arrays-by-summing-values/Notes.md: -------------------------------------------------------------------------------- 1 |

merge-two-2d-arrays-by-summing-values Notes


[ Time taken: 4 m 9 s ] -------------------------------------------------------------------------------- /2856-count-complete-subarrays-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

count-complete-subarrays-in-an-array Notes


[ Time taken: 10 m 33 s ] -------------------------------------------------------------------------------- /297-serialize-and-deserialize-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

serialize-and-deserialize-binary-tree Notes


[ Time taken: 7 m 23 s ] -------------------------------------------------------------------------------- /3002-flight-occupancy-and-waitlist-analysis/Notes.md: -------------------------------------------------------------------------------- 1 |

flight-occupancy-and-waitlist-analysis Notes


[ Time taken: 8 m 28 s ] -------------------------------------------------------------------------------- /3154-maximum-value-of-an-ordered-triplet-i/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-value-of-an-ordered-triplet-i Notes


[ Time taken: 6 m 27 s ] -------------------------------------------------------------------------------- /3201-distribute-candies-among-children-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

distribute-candies-among-children-ii Notes


[ Time taken: 25 m 8 s ] -------------------------------------------------------------------------------- /3242-count-elements-with-maximum-frequency/Notes.md: -------------------------------------------------------------------------------- 1 |

count-elements-with-maximum-frequency Notes


[ Time taken: 3 m 7 s ] -------------------------------------------------------------------------------- /3281-find-peak-calling-hours-for-each-city/Notes.md: -------------------------------------------------------------------------------- 1 |

find-peak-calling-hours-for-each-city Notes


[ Time taken: 14 m 55 s ] -------------------------------------------------------------------------------- /3522-find-the-power-of-k-size-subarrays-i/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-power-of-k-size-subarrays-i Notes


[ Time taken: 16 m 34 s ] -------------------------------------------------------------------------------- /3523-find-the-power-of-k-size-subarrays-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-power-of-k-size-subarrays-ii Notes


[ Time taken: 5 m 1 s ] -------------------------------------------------------------------------------- /3872-find-most-frequent-vowel-and-consonant/Notes.md: -------------------------------------------------------------------------------- 1 |

find-most-frequent-vowel-and-consonant Notes


[ Time taken: 2 m 47 s ] -------------------------------------------------------------------------------- /440-k-th-smallest-in-lexicographical-order/Notes.md: -------------------------------------------------------------------------------- 1 |

k-th-smallest-in-lexicographical-order Notes


[ Time taken: 9 m 30 s ] -------------------------------------------------------------------------------- /579-find-cumulative-salary-of-an-employee/Notes.md: -------------------------------------------------------------------------------- 1 |

find-cumulative-salary-of-an-employee Notes


[ Time taken: 12 m 31 s ] -------------------------------------------------------------------------------- /615-average-salary-departments-vs-company/Notes.md: -------------------------------------------------------------------------------- 1 |

average-salary-departments-vs-company Notes


[ Time taken: 12 m 25 s ] -------------------------------------------------------------------------------- /765-serialize-and-deserialize-n-ary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

serialize-and-deserialize-n-ary-tree Notes


[ Time taken: 15 m 14 s ] -------------------------------------------------------------------------------- /892-shortest-subarray-with-sum-at-least-k/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-subarray-with-sum-at-least-k Notes


[ Time taken: 20 m 40 s ] -------------------------------------------------------------------------------- /957-minimum-add-to-make-parentheses-valid/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-add-to-make-parentheses-valid Notes


[ Time taken: 3 m 20 s ] -------------------------------------------------------------------------------- /982-minimum-increment-to-make-array-unique/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-increment-to-make-array-unique Notes


[ Time taken: 12 m 8 s ] -------------------------------------------------------------------------------- /1049-minimum-domino-rotations-for-equal-row/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-domino-rotations-for-equal-row Notes


[ Time taken: 11 m 30 s ] -------------------------------------------------------------------------------- /1218-lowest-common-ancestor-of-deepest-leaves/Notes.md: -------------------------------------------------------------------------------- 1 |

lowest-common-ancestor-of-deepest-leaves Notes


[ Time taken: 8 m 39 s ] -------------------------------------------------------------------------------- /1371-minimum-remove-to-make-valid-parentheses/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-remove-to-make-valid-parentheses Notes


[ Time taken: 14 m 10 s ] -------------------------------------------------------------------------------- /1497-design-a-stack-with-increment-operation/Notes.md: -------------------------------------------------------------------------------- 1 |

design-a-stack-with-increment-operation Notes


[ Time taken: 3 m 39 s ] -------------------------------------------------------------------------------- /1620-check-if-array-pairs-are-divisible-by-k/Notes.md: -------------------------------------------------------------------------------- 1 |

check-if-array-pairs-are-divisible-by-k Notes


[ Time taken: 13 m 16 s ] -------------------------------------------------------------------------------- /1737-maximum-nesting-depth-of-the-parentheses/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-nesting-depth-of-the-parentheses Notes


[ Time taken: 2 m 55 s ] -------------------------------------------------------------------------------- /1802-number-of-students-unable-to-eat-lunch/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-students-unable-to-eat-lunch Notes


[ Time taken: 10 m 26 s ] -------------------------------------------------------------------------------- /1818-maximum-score-from-removing-substrings/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-score-from-removing-substrings Notes


[ Time taken: 12 m 15 s ] -------------------------------------------------------------------------------- /2148-minimum-number-of-moves-to-seat-everyone/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-moves-to-seat-everyone Notes


[ Time taken: 2 m 59 s ] -------------------------------------------------------------------------------- /2265-partition-array-according-to-given-pivot/Notes.md: -------------------------------------------------------------------------------- 1 |

partition-array-according-to-given-pivot Notes


[ Time taken: 2 m 1 s ] -------------------------------------------------------------------------------- /2320-find-all-k-distant-indices-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

find-all-k-distant-indices-in-an-array Notes


[ Time taken: 10 m 27 s ] -------------------------------------------------------------------------------- /2375-minimum-obstacle-removal-to-reach-corner/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-obstacle-removal-to-reach-corner Notes


[ Time taken: 19 m 12 s ] -------------------------------------------------------------------------------- /2456-construct-smallest-number-from-di-string/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-smallest-number-from-di-string Notes


[ Time taken: 23 m 0 s ] -------------------------------------------------------------------------------- /2581-divide-players-into-teams-of-equal-skill/Notes.md: -------------------------------------------------------------------------------- 1 |

divide-players-into-teams-of-equal-skill Notes


[ Time taken: 5 m 31 s ] -------------------------------------------------------------------------------- /2711-minimum-time-to-visit-a-cell-in-a-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-time-to-visit-a-cell-in-a-grid Notes


[ Time taken: 12 m 46 s ] -------------------------------------------------------------------------------- /2793-count-the-number-of-complete-components/Notes.md: -------------------------------------------------------------------------------- 1 |

count-the-number-of-complete-components Notes


[ Time taken: 4 m 1 s ] -------------------------------------------------------------------------------- /3058-maximum-number-of-k-divisible-components/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-number-of-k-divisible-components Notes


[ Time taken: 16 m 59 s ] -------------------------------------------------------------------------------- /3276-minimum-number-of-pushes-to-type-word-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-pushes-to-type-word-ii Notes


[ Time taken: 10 m 26 s ] -------------------------------------------------------------------------------- /3351-maximize-happiness-of-selected-children/Notes.md: -------------------------------------------------------------------------------- 1 |

maximize-happiness-of-selected-children Notes


[ Time taken: 6 m 3 s ] -------------------------------------------------------------------------------- /3380-shortest-subarray-with-or-at-least-k-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-subarray-with-or-at-least-k-ii Notes


[ Time taken: 27 m 44 s ] -------------------------------------------------------------------------------- /3600-find-the-k-th-character-in-string-game-i/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-k-th-character-in-string-game-i Notes


[ Time taken: 10 m 47 s ] -------------------------------------------------------------------------------- /3627-find-minimum-time-to-reach-last-room-i/Notes.md: -------------------------------------------------------------------------------- 1 |

find-minimum-time-to-reach-last-room-i Notes


[ Time taken: 13 m 39 s ] -------------------------------------------------------------------------------- /766-flatten-a-multilevel-doubly-linked-list/Notes.md: -------------------------------------------------------------------------------- 1 |

flatten-a-multilevel-doubly-linked-list Notes


[ Time taken: 15 m 36 s ] -------------------------------------------------------------------------------- /811-number-of-subarrays-with-bounded-maximum/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-subarrays-with-bounded-maximum Notes


[ Time taken: 10 m 51 s ] -------------------------------------------------------------------------------- /1037-minimum-number-of-k-consecutive-bit-flips/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-k-consecutive-bit-flips Notes


[ Time taken: 13 m 25 s ] -------------------------------------------------------------------------------- /1258-article-views-i/article-views-i.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT author_id AS id 2 | FROM views 3 | WHERE author_id = viewer_id 4 | ORDER BY id; 5 | -------------------------------------------------------------------------------- /1387-find-elements-in-a-contaminated-binary-tree/Notes.md: -------------------------------------------------------------------------------- 1 |

find-elements-in-a-contaminated-binary-tree Notes


[ Time taken: 4 m 54 s ] -------------------------------------------------------------------------------- /1605-minimum-number-of-days-to-make-m-bouquets/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-days-to-make-m-bouquets Notes


[ Time taken: 9 m 28 s ] -------------------------------------------------------------------------------- /1711-find-valid-matrix-given-row-and-column-sums/Notes.md: -------------------------------------------------------------------------------- 1 |

find-valid-matrix-given-row-and-column-sums Notes


[ Time taken: 6 m 20 s ] -------------------------------------------------------------------------------- /1756-minimum-deletions-to-make-string-balanced/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-deletions-to-make-string-balanced Notes


[ Time taken: 19 m 58 s ] -------------------------------------------------------------------------------- /2170-count-number-of-maximum-bitwise-or-subsets/Notes.md: -------------------------------------------------------------------------------- 1 |

count-number-of-maximum-bitwise-or-subsets Notes


[ Time taken: 9 m 15 s ] -------------------------------------------------------------------------------- /2221-check-if-a-parentheses-string-can-be-valid/Notes.md: -------------------------------------------------------------------------------- 1 |

check-if-a-parentheses-string-can-be-valid Notes


[ Time taken: 11 m 24 s ] -------------------------------------------------------------------------------- /2277-count-equal-and-divisible-pairs-in-an-array/Notes.md: -------------------------------------------------------------------------------- 1 |

count-equal-and-divisible-pairs-in-an-array Notes


[ Time taken: 2 m 59 s ] -------------------------------------------------------------------------------- /2473-max-sum-of-a-pair-with-equal-sum-of-digits/Notes.md: -------------------------------------------------------------------------------- 1 |

max-sum-of-a-pair-with-equal-sum-of-digits Notes


[ Time taken: 8 m 16 s ] -------------------------------------------------------------------------------- /2503-longest-subarray-with-maximum-bitwise-and/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-subarray-with-maximum-bitwise-and Notes


[ Time taken: 3 m 57 s ] -------------------------------------------------------------------------------- /2766-find-the-prefix-common-array-of-two-arrays/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-prefix-common-array-of-two-arrays Notes


[ Time taken: 5 m 28 s ] -------------------------------------------------------------------------------- /3172-divisible-and-non-divisible-sums-difference/Notes.md: -------------------------------------------------------------------------------- 1 |

divisible-and-non-divisible-sums-difference Notes


[ Time taken: 1 m 23 s ] -------------------------------------------------------------------------------- /3181-find-building-where-alice-and-bob-can-meet/Notes.md: -------------------------------------------------------------------------------- 1 |

find-building-where-alice-and-bob-can-meet Notes


[ Time taken: 12 m 25 s ] -------------------------------------------------------------------------------- /3251-maximum-area-of-longest-diagonal-rectangle/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-area-of-longest-diagonal-rectangle Notes


[ Time taken: 5 m 21 s ] -------------------------------------------------------------------------------- /3455-minimum-length-of-string-after-operations/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-length-of-string-after-operations Notes


[ Time taken: 4 m 54 s ] -------------------------------------------------------------------------------- /689-maximum-sum-of-3-non-overlapping-subarrays/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-sum-of-3-non-overlapping-subarrays Notes


[ Time taken: 22 m 52 s ] -------------------------------------------------------------------------------- /1147-flip-columns-for-maximum-number-of-equal-rows/Notes.md: -------------------------------------------------------------------------------- 1 |

flip-columns-for-maximum-number-of-equal-rows Notes


[ Time taken: 22 m 19 s ] -------------------------------------------------------------------------------- /1556-make-two-arrays-equal-by-reversing-subarrays/Notes.md: -------------------------------------------------------------------------------- 1 |

make-two-arrays-equal-by-reversing-subarrays Notes


[ Time taken: 2 m 0 s ] -------------------------------------------------------------------------------- /1889-check-if-number-is-a-sum-of-powers-of-three/Notes.md: -------------------------------------------------------------------------------- 1 |

check-if-number-is-a-sum-of-powers-of-three Notes


[ Time taken: 10 m 23 s ] -------------------------------------------------------------------------------- /2006-find-the-student-that-will-replace-the-chalk/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-student-that-will-replace-the-chalk Notes


[ Time taken: 5 m 5 s ] -------------------------------------------------------------------------------- /2054-the-number-of-the-smallest-unoccupied-chair/Notes.md: -------------------------------------------------------------------------------- 1 |

the-number-of-the-smallest-unoccupied-chair Notes


[ Time taken: 14 m 23 s ] -------------------------------------------------------------------------------- /2220-find-all-possible-recipes-from-given-supplies/Notes.md: -------------------------------------------------------------------------------- 1 |

find-all-possible-recipes-from-given-supplies Notes


[ Time taken: 10 m 34 s ] -------------------------------------------------------------------------------- /2246-maximum-employees-to-be-invited-to-a-meeting/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-employees-to-be-invited-to-a-meeting Notes


[ Time taken: 6 m 47 s ] -------------------------------------------------------------------------------- /2599-take-k-of-each-character-from-left-and-right/Notes.md: -------------------------------------------------------------------------------- 1 |

take-k-of-each-character-from-left-and-right Notes


[ Time taken: 26 m 17 s ] -------------------------------------------------------------------------------- /2613-customers-with-strictly-increasing-purchases/Notes.md: -------------------------------------------------------------------------------- 1 |

customers-with-strictly-increasing-purchases Notes


[ Time taken: 9 m 3 s ] -------------------------------------------------------------------------------- /3143-longest-unequal-adjacent-groups-subsequence-i/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-unequal-adjacent-groups-subsequence-i Notes


[ Time taken: 13 m 40 s ] -------------------------------------------------------------------------------- /3329-find-the-length-of-the-longest-common-prefix/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-length-of-the-longest-common-prefix Notes


[ Time taken: 14 m 9 s ] -------------------------------------------------------------------------------- /632-smallest-range-covering-elements-from-k-lists/Notes.md: -------------------------------------------------------------------------------- 1 |

smallest-range-covering-elements-from-k-lists Notes


[ Time taken: 9 m 57 s ] -------------------------------------------------------------------------------- /1570-final-prices-with-a-special-discount-in-a-shop/Notes.md: -------------------------------------------------------------------------------- 1 |

final-prices-with-a-special-discount-in-a-shop Notes


[ Time taken: 4 m 30 s ] -------------------------------------------------------------------------------- /1915-check-if-one-string-swap-can-make-strings-equal/Notes.md: -------------------------------------------------------------------------------- 1 |

check-if-one-string-swap-can-make-strings-equal Notes


[ Time taken: 4 m 29 s ] -------------------------------------------------------------------------------- /2144-maximum-difference-between-increasing-elements/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-difference-between-increasing-elements Notes


[ Time taken: 2 m 59 s ] -------------------------------------------------------------------------------- /2488-divide-intervals-into-minimum-number-of-groups/Notes.md: -------------------------------------------------------------------------------- 1 |

divide-intervals-into-minimum-number-of-groups Notes


[ Time taken: 6 m 37 s ] -------------------------------------------------------------------------------- /2572-append-characters-to-string-to-make-subsequence/Notes.md: -------------------------------------------------------------------------------- 1 |

append-characters-to-string-to-make-subsequence Notes


[ Time taken: 2 m 52 s ] -------------------------------------------------------------------------------- /2800-minimum-string-length-after-removing-substrings/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-string-length-after-removing-substrings Notes


[ Time taken: 5 m 50 s ] -------------------------------------------------------------------------------- /2903-insert-greatest-common-divisors-in-linked-list/Notes.md: -------------------------------------------------------------------------------- 1 |

insert-greatest-common-divisors-in-linked-list Notes


[ Time taken: 4 m 41 s ] -------------------------------------------------------------------------------- /3332-minimum-operations-to-exceed-threshold-value-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-operations-to-exceed-threshold-value-ii Notes


[ Time taken: 4 m 11 s ] -------------------------------------------------------------------------------- /3517-shortest-distance-after-road-addition-queries-i/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-distance-after-road-addition-queries-i Notes


[ Time taken: 22 m 0 s ] -------------------------------------------------------------------------------- /3685-count-subarrays-of-length-three-with-a-condition/Notes.md: -------------------------------------------------------------------------------- 1 |

count-subarrays-of-length-three-with-a-condition Notes


[ Time taken: 2 m 11 s ] -------------------------------------------------------------------------------- /596-classes-more-than-5-students/classes-more-than-5-students.sql: -------------------------------------------------------------------------------- 1 | SELECT class 2 | FROM courses 3 | GROUP BY class 4 | HAVING COUNT(student) >= 5; 5 | -------------------------------------------------------------------------------- /627-swap-salary/swap-salary.sql: -------------------------------------------------------------------------------- 1 | UPDATE Salary 2 | SET sex = CASE 3 | WHEN sex = 'f' THEN 'm' 4 | ELSE 'f' 5 | END; 6 | -------------------------------------------------------------------------------- /1267-remove-zero-sum-consecutive-nodes-from-linked-list/Notes.md: -------------------------------------------------------------------------------- 1 |

remove-zero-sum-consecutive-nodes-from-linked-list Notes


[ Time taken: 20 m 10 s ] -------------------------------------------------------------------------------- /1766-minimum-number-of-removals-to-make-mountain-array/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-removals-to-make-mountain-array Notes


[ Time taken: 31 m 50 s ] -------------------------------------------------------------------------------- /2387-partition-array-such-that-maximum-difference-is-k/Notes.md: -------------------------------------------------------------------------------- 1 |

partition-array-such-that-maximum-difference-is-k Notes


[ Time taken: 7 m 38 s ] -------------------------------------------------------------------------------- /2463-minimum-recolors-to-get-k-consecutive-black-blocks/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-recolors-to-get-k-consecutive-black-blocks Notes


[ Time taken: 7 m 12 s ] -------------------------------------------------------------------------------- /2695-find-score-of-an-array-after-marking-all-elements/Notes.md: -------------------------------------------------------------------------------- 1 |

find-score-of-an-array-after-marking-all-elements Notes


[ Time taken: 4 m 54 s ] -------------------------------------------------------------------------------- /3018-make-string-a-subsequence-using-cyclic-increments/Notes.md: -------------------------------------------------------------------------------- 1 |

make-string-a-subsequence-using-cyclic-increments Notes


[ Time taken: 9 m 8 s ] -------------------------------------------------------------------------------- /3434-find-the-number-of-distinct-colors-among-the-balls/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-number-of-distinct-colors-among-the-balls Notes


[ Time taken: 13 m 0 s ] -------------------------------------------------------------------------------- /3621-minimum-operations-to-make-array-values-equal-to-k/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-operations-to-make-array-values-equal-to-k Notes


[ Time taken: 5 m 40 s ] -------------------------------------------------------------------------------- /1050-construct-binary-search-tree-from-preorder-traversal/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-binary-search-tree-from-preorder-traversal Notes


[ Time taken: 18 m 33 s ] -------------------------------------------------------------------------------- /1298-reverse-substrings-between-each-pair-of-parentheses/Notes.md: -------------------------------------------------------------------------------- 1 |

reverse-substrings-between-each-pair-of-parentheses Notes


[ Time taken: 8 m 27 s ] -------------------------------------------------------------------------------- /1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph/Notes.md: -------------------------------------------------------------------------------- 1 |

all-ancestors-of-a-node-in-a-directed-acyclic-graph Notes


[ Time taken: 11 m 46 s ] -------------------------------------------------------------------------------- /1460-number-of-substrings-containing-all-three-characters/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-substrings-containing-all-three-characters Notes


[ Time taken: 11 m 54 s ] -------------------------------------------------------------------------------- /1529-max-difference-you-can-get-from-changing-an-integer/Notes.md: -------------------------------------------------------------------------------- 1 |

max-difference-you-can-get-from-changing-an-integer Notes


[ Time taken: 23 m 15 s ] -------------------------------------------------------------------------------- /1553-count-triplets-that-can-form-two-arrays-of-equal-xor/Notes.md: -------------------------------------------------------------------------------- 1 |

count-triplets-that-can-form-two-arrays-of-equal-xor Notes


[ Time taken: 19 m 7 s ] -------------------------------------------------------------------------------- /1664-find-users-with-valid-e-mails/find-users-with-valid-e-mails.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM users 3 | WHERE mail REGEXP '^[A-Za-z][A-Za-z0-9_.-]*@leetcode\\.com$'; 4 | -------------------------------------------------------------------------------- /1670-patients-with-a-condition/patients-with-a-condition.sql: -------------------------------------------------------------------------------- 1 | SELECT patient_id, patient_name, conditions 2 | FROM Patients 3 | WHERE conditions REGEXP '(^| )DIAB1'; -------------------------------------------------------------------------------- /1679-shortest-subarray-to-be-removed-to-make-array-sorted/Notes.md: -------------------------------------------------------------------------------- 1 |

shortest-subarray-to-be-removed-to-make-array-sorted Notes


[ Time taken: 32 m 34 s ] -------------------------------------------------------------------------------- /1850-minimum-length-of-string-after-deleting-similar-ends/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-length-of-string-after-deleting-similar-ends Notes


[ Time taken: 10 m 40 s ] -------------------------------------------------------------------------------- /1882-the-number-of-employees-which-report-to-each-employee/Notes.md: -------------------------------------------------------------------------------- 1 |

the-number-of-employees-which-report-to-each-employee Notes


[ Time taken: 9 m 33 s ] -------------------------------------------------------------------------------- /2095-minimum-number-of-swaps-to-make-the-string-balanced/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-swaps-to-make-the-string-balanced Notes


[ Time taken: 12 m 25 s ] -------------------------------------------------------------------------------- /2223-the-number-of-rich-customers/the-number-of-rich-customers.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(DISTINCT customer_id ) AS rich_count 2 | FROM store 3 | WHERE amount > 500; 4 | -------------------------------------------------------------------------------- /2237-longest-palindrome-by-concatenating-two-letter-words/Notes.md: -------------------------------------------------------------------------------- 1 |

longest-palindrome-by-concatenating-two-letter-words Notes


[ Time taken: 17 m 1 s ] -------------------------------------------------------------------------------- /231-power-of-two/power-of-two.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPowerOfTwo(self, n: int) -> bool: 3 | return n > 0 and bin(n).count("1") == 1 4 | -------------------------------------------------------------------------------- /2523-change-null-values-in-a-table-to-the-previous-value/Notes.md: -------------------------------------------------------------------------------- 1 |

change-null-values-in-a-table-to-the-previous-value Notes


[ Time taken: 20 m 2 s ] -------------------------------------------------------------------------------- /2545-height-of-binary-tree-after-subtree-removal-queries/Notes.md: -------------------------------------------------------------------------------- 1 |

height-of-binary-tree-after-subtree-removal-queries Notes


[ Time taken: 27 m 47 s ] -------------------------------------------------------------------------------- /2891-maximum-beauty-of-an-array-after-applying-operation/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-beauty-of-an-array-after-applying-operation Notes


[ Time taken: 13 m 54 s ] -------------------------------------------------------------------------------- /3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-equal-sum-of-two-arrays-after-replacing-zeros Notes


[ Time taken: 7 m 58 s ] -------------------------------------------------------------------------------- /3225-length-of-longest-subarray-with-at-most-k-frequency/Notes.md: -------------------------------------------------------------------------------- 1 |

length-of-longest-subarray-with-at-most-k-frequency Notes


[ Time taken: 6 m 38 s ] -------------------------------------------------------------------------------- /3753-maximum-difference-between-even-and-odd-frequency-i/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-difference-between-even-and-odd-frequency-i Notes


[ Time taken: 2 m 55 s ] -------------------------------------------------------------------------------- /620-not-boring-movies/not-boring-movies.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM cinema 3 | WHERE id % 2 = 1 4 | AND description NOT LIKE '%boring%' 5 | ORDER BY rating DESC; 6 | -------------------------------------------------------------------------------- /1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-cost-to-make-at-least-one-valid-path-in-a-grid Notes


[ Time taken: 9 m 7 s ] -------------------------------------------------------------------------------- /1715-split-a-string-into-the-max-number-of-unique-substrings/Notes.md: -------------------------------------------------------------------------------- 1 |

split-a-string-into-the-max-number-of-unique-substrings Notes


[ Time taken: 8 m 47 s ] -------------------------------------------------------------------------------- /1819-construct-the-lexicographically-largest-valid-sequence/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-the-lexicographically-largest-valid-sequence Notes


[ Time taken: 7 m 12 s ] -------------------------------------------------------------------------------- /2188-minimized-maximum-of-products-distributed-to-any-store/Notes.md: -------------------------------------------------------------------------------- 1 |

minimized-maximum-of-products-distributed-to-any-store Notes


[ Time taken: 13 m 6 s ] -------------------------------------------------------------------------------- /2356-largest-combination-with-bitwise-and-greater-than-zero/Notes.md: -------------------------------------------------------------------------------- 1 |

largest-combination-with-bitwise-and-greater-than-zero Notes


[ Time taken: 10 m 43 s ] -------------------------------------------------------------------------------- /2524-largest-positive-integer-that-exists-with-its-negative/Notes.md: -------------------------------------------------------------------------------- 1 |

largest-positive-integer-that-exists-with-its-negative Notes


[ Time taken: 1 m 24 s ] -------------------------------------------------------------------------------- /2614-maximum-count-of-positive-integer-and-negative-integer/Notes.md: -------------------------------------------------------------------------------- 1 |

maximum-count-of-positive-integer-and-negative-integer Notes


[ Time taken: 1 m 40 s ] -------------------------------------------------------------------------------- /1701-remove-max-number-of-edges-to-keep-graph-fully-traversable/Notes.md: -------------------------------------------------------------------------------- 1 |

remove-max-number-of-edges-to-keep-graph-fully-traversable Notes


[ Time taken: 5 m 51 s ] -------------------------------------------------------------------------------- /1744-number-of-ways-to-form-a-target-string-given-a-dictionary/Notes.md: -------------------------------------------------------------------------------- 1 |

number-of-ways-to-form-a-target-string-given-a-dictionary Notes


[ Time taken: 13 m 37 s ] -------------------------------------------------------------------------------- /3174-minimum-number-of-changes-to-make-binary-string-beautiful/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-changes-to-make-binary-string-beautiful Notes


[ Time taken: 10 m 12 s ] -------------------------------------------------------------------------------- /3219-make-lexicographically-smallest-array-by-swapping-elements/Notes.md: -------------------------------------------------------------------------------- 1 |

make-lexicographically-smallest-array-by-swapping-elements Notes


[ Time taken: 9 m 49 s ] -------------------------------------------------------------------------------- /584-find-customer-referee/find-customer-referee.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | name 3 | FROM 4 | customer 5 | WHERE 6 | referee_id != 2 7 | OR referee_id IS NULL; 8 | -------------------------------------------------------------------------------- /1473-find-the-longest-substring-containing-vowels-in-even-counts/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-longest-substring-containing-vowels-in-even-counts Notes


[ Time taken: 14 m 37 s ] -------------------------------------------------------------------------------- /1895-minimum-number-of-operations-to-move-all-balls-to-each-box/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-operations-to-move-all-balls-to-each-box Notes


[ Time taken: 21 m 36 s ] -------------------------------------------------------------------------------- /2217-step-by-step-directions-from-a-binary-tree-node-to-another/Notes.md: -------------------------------------------------------------------------------- 1 |

step-by-step-directions-from-a-binary-tree-node-to-another Notes


[ Time taken: 20 m 37 s ] -------------------------------------------------------------------------------- /2431-products-with-three-or-more-orders-in-two-consecutive-years/Notes.md: -------------------------------------------------------------------------------- 1 |

products-with-three-or-more-orders-in-two-consecutive-years Notes


[ Time taken: 19 m 52 s ] -------------------------------------------------------------------------------- /2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-number-of-operations-to-sort-a-binary-tree-by-level Notes


[ Time taken: 8 m 45 s ] -------------------------------------------------------------------------------- /3213-count-subarrays-where-max-element-appears-at-least-k-times/Notes.md: -------------------------------------------------------------------------------- 1 |

count-subarrays-where-max-element-appears-at-least-k-times Notes


[ Time taken: 22 m 22 s ] -------------------------------------------------------------------------------- /3633-maximize-the-number-of-target-nodes-after-connecting-trees-i/Notes.md: -------------------------------------------------------------------------------- 1 |

maximize-the-number-of-target-nodes-after-connecting-trees-i Notes


[ Time taken: 9 m 53 s ] -------------------------------------------------------------------------------- /925-construct-binary-tree-from-preorder-and-postorder-traversal/Notes.md: -------------------------------------------------------------------------------- 1 |

construct-binary-tree-from-preorder-and-postorder-traversal Notes


[ Time taken: 18 m 6 s ] -------------------------------------------------------------------------------- /3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-operations-to-make-binary-array-elements-equal-to-one-i Notes


[ Time taken: 7 m 10 s ] -------------------------------------------------------------------------------- /3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii/Notes.md: -------------------------------------------------------------------------------- 1 |

count-of-substrings-containing-every-vowel-and-k-consonants-ii Notes


[ Time taken: 18 m 46 s ] -------------------------------------------------------------------------------- /1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/Notes.md: -------------------------------------------------------------------------------- 1 |

the-k-th-lexicographical-string-of-all-happy-strings-of-length-n Notes


[ Time taken: 7 m 57 s ] -------------------------------------------------------------------------------- /2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-minimum-and-maximum-number-of-nodes-between-critical-points Notes


[ Time taken: 9 m 45 s ] -------------------------------------------------------------------------------- /1616-minimum-difference-between-largest-and-smallest-value-in-three-moves/Notes.md: -------------------------------------------------------------------------------- 1 |

minimum-difference-between-largest-and-smallest-value-in-three-moves Notes


[ Time taken: 29 m 23 s ] -------------------------------------------------------------------------------- /2864-is-object-empty/is-object-empty.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Object|Array} obj 3 | * @return {boolean} 4 | */ 5 | var isEmpty = function(obj) { 6 | return Object.keys(obj).length === 0; 7 | }; -------------------------------------------------------------------------------- /610-triangle-judgement/triangle-judgement.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | x, 3 | y, 4 | z, 5 | IF(x + y > z AND y + z > x AND z + x > y, "Yes", "No") AS Triangle 6 | FROM 7 | Triangle; 8 | -------------------------------------------------------------------------------- /151-reverse-words-in-a-string/reverse-words-in-a-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reverseWords(self, s: str) -> str: 3 | return " ".join(reversed(re.split(r"\s+", s.strip()))) 4 | -------------------------------------------------------------------------------- /197-rising-temperature/rising-temperature.sql: -------------------------------------------------------------------------------- 1 | SELECT w1.id 2 | FROM Weather w1 3 | JOIN Weather w2 4 | ON DATEDIFF(w1.recordDate, w2.recordDate) = 1 5 | WHERE w1.temperature > w2.temperature; 6 | 7 | -------------------------------------------------------------------------------- /1291-immediate-food-delivery-i/immediate-food-delivery-i.sql: -------------------------------------------------------------------------------- 1 | SELECT ROUND( 2 | 100 * AVG(order_date = customer_pref_delivery_date), 3 | 2 4 | ) AS immediate_percentage 5 | FROM 6 | Delivery; 7 | -------------------------------------------------------------------------------- /1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/Notes.md: -------------------------------------------------------------------------------- 1 |

find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance Notes


[ Time taken: 24 m 39 s ] -------------------------------------------------------------------------------- /1811-fix-names-in-a-table/fix-names-in-a-table.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | user_id, 3 | CONCAT(UPPER(LEFT(name, 1)), LOWER(SUBSTR(name, 2))) AS name 4 | FROM 5 | users 6 | ORDER BY 7 | user_id; 8 | -------------------------------------------------------------------------------- /557-reverse-words-in-a-string-iii/reverse-words-in-a-string-iii.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reverseWords(self, s: str) -> str: 3 | return " ".join([word[::-1] for word in s.split()]) 4 | -------------------------------------------------------------------------------- /181-employees-earning-more-than-their-managers/employees-earning-more-than-their-managers.sql: -------------------------------------------------------------------------------- 1 | SELECT e1.name AS Employee 2 | FROM employee AS e1 3 | JOIN employee AS e2 ON e1.managerId = e2.id 4 | WHERE e1.salary > e2.salary; 5 | -------------------------------------------------------------------------------- /2041-the-latest-login-in-2020/the-latest-login-in-2020.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | user_id, 3 | MAX(time_stamp) AS last_stamp 4 | FROM 5 | logins 6 | WHERE 7 | YEAR(time_stamp) = 2020 8 | GROUP BY 9 | user_id; 10 | -------------------------------------------------------------------------------- /577-employee-bonus/employee-bonus.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e.name, 3 | b.bonus 4 | FROM 5 | employee AS e 6 | LEFT JOIN 7 | bonus AS b 8 | ON 9 | e.empid = b.empid 10 | WHERE 11 | b.bonus < 1000 OR b.bonus IS NULL; 12 | -------------------------------------------------------------------------------- /2495-number-of-unique-subjects-taught-by-each-teacher/number-of-unique-subjects-taught-by-each-teacher.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | teacher_id, 3 | COUNT(DISTINCT subject_id) AS cnt 4 | FROM 5 | teacher 6 | GROUP BY 7 | teacher_id; 8 | -------------------------------------------------------------------------------- /3259-binary-tree-nodes/binary-tree-nodes.sql: -------------------------------------------------------------------------------- 1 | SELECT N, 2 | CASE 3 | WHEN p IS NULL THEN 'Root' 4 | WHEN n IN (SELECT p FROM tree) THEN 'Inner' 5 | ELSE 'Leaf' 6 | END AS type 7 | FROM tree 8 | ORDER BY N; 9 | -------------------------------------------------------------------------------- /1268-market-analysis-i/market-analysis-i.sql: -------------------------------------------------------------------------------- 1 | SELECT u.user_id as buyer_id, u.join_date, count(o.order_id) as 'orders_in_2019' 2 | FROM users u 3 | LEFT JOIN Orders o 4 | ON o.buyer_id=u.user_id AND YEAR(order_date)='2019' 5 | GROUP BY u.user_id 6 | -------------------------------------------------------------------------------- /3194-find-words-containing-character/find-words-containing-character.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def findWordsContaining(self, words: List[str], x: str) -> List[int]: 3 | return [i for i, word in enumerate(words) if x in word] 4 | -------------------------------------------------------------------------------- /1136-actors-and-directors-who-cooperated-at-least-three-times/actors-and-directors-who-cooperated-at-least-three-times.sql: -------------------------------------------------------------------------------- 1 | SELECT actor_id, director_id 2 | FROM actordirector 3 | GROUP BY actor_id, director_id 4 | HAVING COUNT(timestamp) >= 3; 5 | -------------------------------------------------------------------------------- /1174-sales-analysis-iii/sales-analysis-iii.sql: -------------------------------------------------------------------------------- 1 | SELECT product_id, product_name 2 | FROM Sales 3 | JOIN Product 4 | USING (product_id) 5 | GROUP BY product_id 6 | HAVING MIN(sale_date) >= '2019-01-01' 7 | AND MAX(sale_date) <= '2019-03-31'; 8 | -------------------------------------------------------------------------------- /570-managers-with-at-least-5-direct-reports/managers-with-at-least-5-direct-reports.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e1.name 3 | FROM employee AS e1 4 | JOIN employee AS e2 5 | ON e1.id = e2.managerId 6 | GROUP BY e1.id, e1.name 7 | HAVING COUNT(*) >= 5; 8 | -------------------------------------------------------------------------------- /180-consecutive-numbers/consecutive-numbers.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT 2 | l1.num AS ConsecutiveNums 3 | FROM logs l1 4 | JOIN logs l2 ON l1.id = l2.id + 1 5 | JOIN logs l3 ON l2.id = l3.id + 1 6 | WHERE 7 | l1.num = l2.num AND 8 | l2.num = l3.num; 9 | -------------------------------------------------------------------------------- /1916-find-center-of-star-graph/find-center-of-star-graph.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def findCenter(self, edges: List[List[int]]) -> int: 3 | # Find the common node between the first two edges 4 | return (set(edges[0]) & set(edges[1])).pop() 5 | -------------------------------------------------------------------------------- /2136-find-cutoff-score-for-each-school/find-cutoff-score-for-each-school.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | school_id, 3 | IFNULL(MIN(score), -1) AS score 4 | FROM 5 | Schools 6 | LEFT JOIN 7 | Exam ON capacity >= student_count 8 | GROUP BY 9 | school_id; -------------------------------------------------------------------------------- /1509-replace-employee-id-with-the-unique-identifier/replace-employee-id-with-the-unique-identifier.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | u.unique_id, 3 | e.name 4 | FROM 5 | employees AS e 6 | LEFT JOIN 7 | employeeuni AS u 8 | ON 9 | e.id = u.id; 10 | -------------------------------------------------------------------------------- /3172-divisible-and-non-divisible-sums-difference/divisible-and-non-divisible-sums-difference.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def differenceOfSums(self, n: int, m: int) -> int: 3 | return sum(num if num % m != 0 else -num for num in range(1, n + 1)) 4 | 5 | -------------------------------------------------------------------------------- /586-customer-placing-the-largest-number-of-orders/customer-placing-the-largest-number-of-orders.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | customer_number 3 | FROM 4 | orders 5 | GROUP BY 6 | customer_number 7 | ORDER BY 8 | COUNT(order_number) DESC 9 | LIMIT 1; 10 | -------------------------------------------------------------------------------- /1908-recyclable-and-low-fat-products/recyclable-and-low-fat-products.sql: -------------------------------------------------------------------------------- 1 | -- MySQL query to select products that are both low fat and recyclable 2 | SELECT 3 | product_id 4 | FROM 5 | products 6 | WHERE 7 | low_fats = 'Y' 8 | AND recyclable = 'Y'; 9 | -------------------------------------------------------------------------------- /595-big-countries/big-countries.sql: -------------------------------------------------------------------------------- 1 | -- MySQL query to select countries with area >= 3,000,000 or population >= 25,000,000 2 | SELECT 3 | name, 4 | population, 5 | area 6 | FROM 7 | world 8 | WHERE 9 | area >= 3000000 OR population >= 25000000; 10 | -------------------------------------------------------------------------------- /619-biggest-single-number/biggest-single-number.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | MAX(num) AS num 3 | FROM ( 4 | SELECT 5 | num 6 | FROM 7 | MyNumbers 8 | GROUP BY 9 | num 10 | HAVING 11 | COUNT(num) = 1 12 | ) AS unique_numbers; 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Leetcode-Solutions 2 | 3 | Welcome to my LeetCode solutions repository! Here, you'll find my solutions to various LeetCode problems implemented in Python, organized by problem number and name, accompanied by a brief description and explanation of the approach used. 4 | -------------------------------------------------------------------------------- /2127-employees-whose-manager-left-the-company/employees-whose-manager-left-the-company.sql: -------------------------------------------------------------------------------- 1 | SELECT employee_id 2 | FROM employees 3 | WHERE salary < 30000 4 | AND manager_id IS NOT NULL 5 | AND manager_id NOT IN (SELECT employee_id FROM employees) 6 | ORDER BY employee_id; 7 | 8 | -------------------------------------------------------------------------------- /2649-count-total-number-of-colored-cells/count-total-number-of-colored-cells.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def coloredCells(self, layers: int) -> int: 3 | """Computes the total number of colored cells in an expanding pattern.""" 4 | return layers**2 + (layers - 1)**2 5 | -------------------------------------------------------------------------------- /612-shortest-distance-in-a-plane/shortest-distance-in-a-plane.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | MIN(ROUND(POWER(POWER((p1.x - p2.x), 2) + POWER((p1.y - p2.y), 2), 0.5), 2)) AS shortest 3 | FROM 4 | point2d AS p1 5 | JOIN 6 | point2d AS p2 7 | ON 8 | (p1.x != p2.x OR p1.y != p2.y); 9 | -------------------------------------------------------------------------------- /2024-calculate-special-bonus/calculate-special-bonus.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | employee_id, 3 | CASE 4 | WHEN employee_id % 2 = 1 AND name NOT LIKE 'M%' THEN salary 5 | ELSE 0 6 | END AS bonus 7 | FROM 8 | employees 9 | ORDER BY 10 | employee_id; 11 | -------------------------------------------------------------------------------- /1089-remove-vowels-from-a-string/remove-vowels-from-a-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def removeVowels(self, s: str) -> str: 3 | res = [] 4 | for char in s: 5 | if char not in "aeiou": 6 | res.append(char) 7 | return "".join(res) 8 | -------------------------------------------------------------------------------- /1625-group-sold-products-by-the-date/group-sold-products-by-the-date.sql: -------------------------------------------------------------------------------- 1 | SELECT sell_date, 2 | COUNT(DISTINCT product) AS num_sold, 3 | GROUP_CONCAT(DISTINCT product ORDER BY product ASC SEPARATOR ',') AS products 4 | FROM activities 5 | GROUP BY sell_date 6 | ORDER BY sell_date; 7 | -------------------------------------------------------------------------------- /2840-immediate-food-delivery-iii/immediate-food-delivery-iii.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | select order_date, round(100*sum(if(order_date=customer_pref_delivery_date, 1, 0))/count(delivery_id), 2) as immediate_percentage from delivery group by order_date order by order_date; -------------------------------------------------------------------------------- /2087-confirmation-rate/confirmation-rate.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | s.user_id, 3 | ROUND( 4 | SUM(CASE WHEN c.action = 'confirmed' THEN 1 ELSE 0 END) / COUNT(*), 2 5 | ) AS confirmation_rate 6 | FROM signups AS s 7 | LEFT JOIN confirmations AS c ON s.user_id = c.user_id 8 | GROUP BY s.user_id; 9 | -------------------------------------------------------------------------------- /2734-array-prototype-last/array-prototype-last.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @return {null|boolean|number|string|Array|Object} 3 | */ 4 | Array.prototype.last = function() { 5 | return this.length > 0 ? this[this.length-1] : -1; 6 | }; 7 | 8 | /** 9 | * const arr = [1, 2, 3]; 10 | * arr.last(); // 3 11 | */ -------------------------------------------------------------------------------- /3160-calculate-orders-within-each-interval/calculate-orders-within-each-interval.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | IF(minute % 6 = 0, minute DIV 6, minute DIV 6 + 1) AS interval_no, 3 | SUM(order_count) AS total_orders 4 | FROM 5 | orders 6 | GROUP BY 7 | interval_no 8 | ORDER BY 9 | interval_no; 10 | -------------------------------------------------------------------------------- /601-human-traffic-of-stadium/human-traffic-of-stadium.sql: -------------------------------------------------------------------------------- 1 | with q1 as ( 2 | select *, id - row_number() over() as id_diff 3 | from stadium 4 | where people > 99 5 | ) 6 | select id, visit_date, people 7 | from q1 8 | where id_diff in (select id_diff from q1 group by id_diff having count(*) > 2) 9 | order by visit_date -------------------------------------------------------------------------------- /1161-project-employees-i/project-employees-i.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | p.project_id, 3 | ROUND(SUM(e.experience_years) / COUNT(e.employee_id), 2) AS average_years 4 | FROM 5 | project AS p 6 | LEFT JOIN 7 | employee AS e 8 | ON 9 | p.employee_id = e.employee_id 10 | GROUP BY 11 | p.project_id; 12 | -------------------------------------------------------------------------------- /2820-return-length-of-arguments-passed/return-length-of-arguments-passed.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {...(null|boolean|number|string|Array|Object)} args 3 | * @return {number} 4 | */ 5 | var argumentsLength = function(...args) { 6 | return args.length; 7 | }; 8 | 9 | /** 10 | * argumentsLength(1, 2, 3); // 3 11 | */ -------------------------------------------------------------------------------- /183-customers-who-never-order/customers-who-never-order.sql: -------------------------------------------------------------------------------- 1 | -- Query to find customers who never placed an order 2 | SELECT 3 | name AS Customers 4 | FROM 5 | Customers c 6 | LEFT JOIN 7 | Orders o ON c.id = o.customerId 8 | WHERE 9 | o.id IS NULL; -- Ensure the customer has no matching orders 10 | -------------------------------------------------------------------------------- /1892-find-total-time-spent-by-each-employee/find-total-time-spent-by-each-employee.sql: -------------------------------------------------------------------------------- 1 | -- Calculate the total time spent by each employee per day 2 | SELECT 3 | emp_id, 4 | event_day AS "day", 5 | SUM(out_time - in_time) AS total_time 6 | FROM 7 | employees 8 | GROUP BY 9 | emp_id, event_day; 10 | -------------------------------------------------------------------------------- /1338-queries-quality-and-percentage/queries-quality-and-percentage.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | query_name, 3 | ROUND(AVG(CAST(rating AS DECIMAL) / position), 2) AS quality, 4 | ROUND(SUM(CASE WHEN rating < 3 THEN 1 ELSE 0 END) * 100 / COUNT(*), 2) AS poor_query_percentage 5 | FROM 6 | queries 7 | GROUP BY 8 | query_name; 9 | -------------------------------------------------------------------------------- /1541-top-travellers/top-travellers.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | u.name, 3 | IFNULL(SUM(r.distance), 0) AS travelled_distance 4 | FROM 5 | users AS u 6 | LEFT JOIN 7 | rides AS r 8 | ON 9 | u.id = r.user_id 10 | GROUP BY 11 | u.id, u.name 12 | ORDER BY 13 | travelled_distance DESC, 14 | name ASC; 15 | -------------------------------------------------------------------------------- /176-second-highest-salary/second-highest-salary.sql: -------------------------------------------------------------------------------- 1 | -- Selecting the second highest distinct salary from the Employee table 2 | SELECT 3 | IF(COUNT(e.salary) >= 2, MIN(e.salary), NULL) AS SecondHighestSalary 4 | FROM 5 | (SELECT DISTINCT salary 6 | FROM employee 7 | ORDER BY salary DESC 8 | LIMIT 2) AS e; 9 | -------------------------------------------------------------------------------- /2809-create-hello-world-function/create-hello-world-function.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @return {Function} 3 | */ 4 | var createHelloWorld = function() { 5 | 6 | return function(...args) { 7 | return "Hello World"; 8 | } 9 | }; 10 | 11 | /** 12 | * const f = createHelloWorld(); 13 | * f(); // "Hello World" 14 | */ -------------------------------------------------------------------------------- /812-rotate-string/rotate-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def rotateString(self, s: str, goal: str) -> bool: 3 | # Check if 'goal' can be obtained by rotating 's' 4 | # This is true if 'goal' is a substring of 's + s' and both strings have the same length 5 | return len(goal) == len(s) and goal in (s + s) 6 | -------------------------------------------------------------------------------- /175-combine-two-tables/combine-two-tables.sql: -------------------------------------------------------------------------------- 1 | -- Query to select first name, last name, city, and state by joining the person and address tables 2 | SELECT 3 | p.firstName, 4 | p.lastName, 5 | a.city, 6 | a.state 7 | FROM 8 | person AS p 9 | LEFT JOIN 10 | address AS a ON p.personId = a.personId; 11 | -------------------------------------------------------------------------------- /1390-average-selling-price/average-selling-price.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | p.product_id, 3 | IFNULL(ROUND(SUM(u.units * p.price) / SUM(u.units), 2), 0) AS average_price 4 | FROM Prices p 5 | LEFT JOIN UnitsSold u 6 | ON p.product_id = u.product_id 7 | AND u.purchase_date BETWEEN p.start_date AND p.end_date 8 | GROUP BY p.product_id; 9 | -------------------------------------------------------------------------------- /196-delete-duplicate-emails/delete-duplicate-emails.sql: -------------------------------------------------------------------------------- 1 | -- Delete duplicate email entries while keeping the record with the smallest id 2 | DELETE p2 3 | FROM Person p1 4 | JOIN Person p2 5 | ON p1.Email = p2.Email -- Match records with the same email 6 | AND p1.Id < p2.Id; -- Ensure we are deleting the record with the larger id 7 | -------------------------------------------------------------------------------- /2167-number-of-accounts-that-did-not-stream/number-of-accounts-that-did-not-stream.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(s.account_id) AS accounts_count 2 | FROM Subscriptions AS s 3 | LEFT JOIN streams AS st USING(account_id) 4 | WHERE (YEAR(start_date) <= 2021 AND YEAR(end_date) >= 2021) 5 | AND (st.stream_date IS NULL OR YEAR(st.stream_date) != 2021); 6 | -------------------------------------------------------------------------------- /2376-number-of-times-a-driver-was-a-passenger/number-of-times-a-driver-was-a-passenger.sql: -------------------------------------------------------------------------------- 1 | WITH unique_drivers AS ( 2 | SELECT DISTINCT driver_id AS ddi FROM rides 3 | ) 4 | SELECT r1.ddi AS driver_id, COUNT(r2.passenger_id) AS cnt 5 | FROM unique_drivers AS r1 6 | LEFT JOIN rides AS r2 ON r1.ddi = r2.passenger_id 7 | GROUP BY r1.ddi; 8 | -------------------------------------------------------------------------------- /1179-game-play-analysis-i/game-play-analysis-i.sql: -------------------------------------------------------------------------------- 1 | -- Select player_id and the minimum event_date to find the first login date for each player 2 | SELECT 3 | player_id, 4 | MIN(event_date) AS first_login 5 | FROM 6 | activity 7 | -- Group by player_id to get the first login for each player 8 | GROUP BY 9 | player_id; 10 | -------------------------------------------------------------------------------- /1759-find-the-missing-ids/find-the-missing-ids.sql: -------------------------------------------------------------------------------- 1 | WITH RECURSIVE id_table AS ( 2 | SELECT 1 AS ids 3 | UNION 4 | SELECT ids + 1 5 | FROM id_table 6 | WHERE ids < (SELECT MAX(customer_id) FROM Customers) 7 | LIMIT 100 8 | ) 9 | SELECT ids 10 | FROM id_table 11 | WHERE ids NOT IN (SELECT customer_id FROM Customers); -------------------------------------------------------------------------------- /2761-array-reduce-transformation/array-reduce-transformation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number[]} nums 3 | * @param {Function} fn 4 | * @param {number} init 5 | * @return {number} 6 | */ 7 | var reduce = function(nums, fn, init) { 8 | val = init; 9 | for (let num of nums) 10 | val = fn(val, num); 11 | return val; 12 | }; -------------------------------------------------------------------------------- /2746-filter-elements-from-array/filter-elements-from-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number[]} arr 3 | * @param {Function} fn 4 | * @return {number[]} 5 | */ 6 | var filter = function(arr, fn) { 7 | res = [] 8 | for (let i = 0; i < arr.length; i++) 9 | if (fn(arr[i], i)) 10 | res.push(arr[i]) 11 | return res 12 | }; -------------------------------------------------------------------------------- /3055-maximum-odd-binary-number/maximum-odd-binary-number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maximumOddBinaryNumber(self, s: str) -> str: 3 | ones = s.count("1") 4 | arr = list(s) 5 | arr[0:ones-1] = ["1"] * (ones-1) 6 | arr[ones-1:-1] = ["0"] * (len(arr)-ones) 7 | arr[-1] = "1" 8 | return "".join(arr) 9 | -------------------------------------------------------------------------------- /2732-counter/counter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number} n 3 | * @return {Function} counter 4 | */ 5 | var createCounter = function(n) { 6 | 7 | return function() { 8 | return n++; 9 | }; 10 | }; 11 | 12 | /** 13 | * const counter = createCounter(10) 14 | * counter() // 10 15 | * counter() // 11 16 | * counter() // 12 17 | */ -------------------------------------------------------------------------------- /602-friend-requests-ii-who-has-the-most-friends/friend-requests-ii-who-has-the-most-friends.sql: -------------------------------------------------------------------------------- 1 | WITH friends AS ( 2 | SELECT requester_id AS r FROM RequestAccepted 3 | UNION ALL 4 | SELECT accepter_id AS r FROM RequestAccepted 5 | ) 6 | SELECT r AS id, COUNT(*) AS num 7 | FROM friends 8 | GROUP BY r 9 | ORDER BY num DESC 10 | LIMIT 1; 11 | -------------------------------------------------------------------------------- /1862-count-apples-and-oranges/count-apples-and-oranges.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT 3 | SUM(b.apple_count + COALESCE(c.apple_count, 0)) AS apple_count, 4 | SUM(b.orange_count + COALESCE(c.orange_count, 0)) AS orange_count 5 | FROM 6 | boxes AS b 7 | LEFT JOIN 8 | chests AS c 9 | USING 10 | (chest_id); 11 | -------------------------------------------------------------------------------- /2733-sleep/sleep.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number} millis 3 | * @return {Promise} 4 | */ 5 | async function sleep(millis) { 6 | return new Promise((resolve, reject) => { 7 | setTimeout(()=>{resolve("success")}, millis); 8 | }) 9 | } 10 | 11 | /** 12 | * let t = Date.now() 13 | * sleep(100).then(() => console.log(Date.now() - t)) // 100 14 | */ -------------------------------------------------------------------------------- /1556-make-two-arrays-equal-by-reversing-subarrays/make-two-arrays-equal-by-reversing-subarrays.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from collections import Counter 3 | 4 | class Solution: 5 | def canBeEqual(self, target: List[int], arr: List[int]) -> bool: 6 | # Count the frequency of each element in target and arr 7 | return Counter(target) == Counter(arr) 8 | -------------------------------------------------------------------------------- /2441-arrange-table-by-gender/arrange-table-by-gender.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | user_id, 3 | gender 4 | FROM 5 | genders 6 | ORDER BY 7 | RANK() OVER (PARTITION BY gender ORDER BY user_id) + 8 | (CASE 9 | WHEN gender = 'female' THEN 0.1 10 | WHEN gender = 'other' THEN 0.2 11 | ELSE 0.3 12 | END); 13 | -------------------------------------------------------------------------------- /3530-odd-and-even-transactions/odd-and-even-transactions.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | transaction_date, 3 | SUM(CASE WHEN amount % 2 = 1 THEN amount ELSE 0 END) AS odd_sum, 4 | SUM(CASE WHEN amount % 2 = 0 THEN amount ELSE 0 END) AS even_sum 5 | FROM 6 | transactions 7 | GROUP BY 8 | transaction_date 9 | ORDER BY 10 | transaction_date ASC; 11 | -------------------------------------------------------------------------------- /1453-ads-performance/ads-performance.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | ad_id, 3 | ROUND( 4 | IFNULL( 5 | (SUM(action = 'Clicked') / (SUM(action = 'Clicked') + SUM(action = 'Viewed'))) * 100, 6 | 0 7 | ), 8 | 2 9 | ) AS ctr 10 | FROM 11 | Ads 12 | GROUP BY 13 | ad_id 14 | ORDER BY 15 | ctr DESC, 16 | ad_id ASC; 17 | -------------------------------------------------------------------------------- /2798-chunk-array/chunk-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Array} arr 3 | * @param {number} size 4 | * @return {Array} 5 | */ 6 | var chunk = function(arr, size) { 7 | let index = 0; 8 | let res = []; 9 | while (index < arr.length) { 10 | res.push(arr.slice(index, index+size)); 11 | index += size; 12 | } 13 | return res 14 | }; 15 | -------------------------------------------------------------------------------- /1135-customers-who-bought-all-products/customers-who-bought-all-products.sql: -------------------------------------------------------------------------------- 1 | WITH distinct_product_count AS ( 2 | SELECT COUNT(DISTINCT product_key) AS total_products 3 | FROM product 4 | ) 5 | SELECT c.customer_id 6 | FROM customer c 7 | JOIN distinct_product_count dpc 8 | GROUP BY c.customer_id 9 | HAVING COUNT(DISTINCT c.product_key) = MAX(dpc.total_products); 10 | -------------------------------------------------------------------------------- /1462-list-the-products-ordered-in-a-period/list-the-products-ordered-in-a-period.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | p.product_name, 3 | SUM(o.unit) AS unit 4 | FROM 5 | products AS p 6 | JOIN 7 | orders AS o 8 | ON 9 | p.product_id = o.product_id 10 | WHERE 11 | o.order_date LIKE '2020-02-%' 12 | GROUP BY 13 | p.product_name 14 | HAVING 15 | unit >= 100; 16 | -------------------------------------------------------------------------------- /3255-pizza-toppings-cost-analysis/pizza-toppings-cost-analysis.sql: -------------------------------------------------------------------------------- 1 | SELECT CONCAT(t1.topping_name, ',', t2.topping_name, ',', t3.topping_name) AS pizza, 2 | (t1.cost + t2.cost + t3.cost) AS total_cost 3 | FROM toppings AS t1 4 | JOIN toppings AS t2 ON t1.topping_name < t2.topping_name 5 | JOIN toppings AS t3 ON t2.topping_name < t3.topping_name 6 | ORDER BY total_cost DESC, pizza ASC; 7 | -------------------------------------------------------------------------------- /3340-snaps-analysis/snaps-analysis.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | age_bucket, 3 | ROUND(100 * SUM(IF(activity_type = "send", 1, 0) * time_spent) / SUM(time_spent), 2) AS send_perc, 4 | ROUND(100 * SUM(IF(activity_type = "open", 1, 0) * time_spent) / SUM(time_spent), 2) AS open_perc 5 | FROM 6 | activities 7 | JOIN 8 | age USING (user_id) 9 | GROUP BY 10 | age_bucket; 11 | -------------------------------------------------------------------------------- /1225-active-businesses/active-businesses.sql: -------------------------------------------------------------------------------- 1 | WITH average_activity AS ( 2 | SELECT event_type, AVG(occurrences) AS average_occurrence 3 | FROM events 4 | GROUP BY event_type 5 | ) 6 | SELECT e.business_id 7 | FROM events AS e 8 | JOIN average_activity AS a USING(event_type) 9 | WHERE occurrences > average_occurrence 10 | GROUP BY business_id 11 | HAVING COUNT(*) > 1; 12 | -------------------------------------------------------------------------------- /2747-apply-transform-over-each-element-in-array/apply-transform-over-each-element-in-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number[]} arr 3 | * @param {Function} fn 4 | * @return {number[]} 5 | */ 6 | var map = function(arr, fn) { 7 | let res = []; 8 | for (let i = 0; i < arr.length; i++) { 9 | res.push(fn(arr[i], i)); 10 | } 11 | return res; 12 | 13 | 14 | }; -------------------------------------------------------------------------------- /3300-friday-purchases-i/friday-purchases-i.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT 3 | WEEK(purchase_date, 3) - WEEK('2023-11-01', 3) + 1 AS week_of_month, 4 | purchase_date, 5 | SUM(amount_spend) AS total_amount 6 | FROM 7 | Purchases 8 | WHERE 9 | DAYOFWEEK(purchase_date) = 6 10 | GROUP BY 11 | week_of_month 12 | ORDER BY 13 | week_of_month; 14 | -------------------------------------------------------------------------------- /1155-product-sales-analysis-iii/product-sales-analysis-iii.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | s1.product_id, 3 | s1.year AS first_year, 4 | s1.quantity, 5 | s1.price 6 | FROM sales AS s1 7 | JOIN ( 8 | SELECT 9 | product_id, 10 | MIN(year) AS year 11 | FROM sales 12 | GROUP BY product_id 13 | ) AS s2 14 | ON s1.product_id = s2.product_id AND s1.year = s2.year; 15 | -------------------------------------------------------------------------------- /3397-find-the-integer-added-to-array-i/find-the-integer-added-to-array-i.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def addedInteger(self, nums1: List[int], nums2: List[int]) -> int: 3 | # Find the minimum value in nums1 and nums2 4 | min_nums1 = min(nums1) 5 | min_nums2 = min(nums2) 6 | 7 | # Return the difference between the minimum values 8 | return min_nums2 - min_nums1 9 | -------------------------------------------------------------------------------- /626-exchange-seats/exchange-seats.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | CASE 3 | WHEN s.id % 2 <> 0 AND s.id = (SELECT COUNT(*) FROM Seat) THEN s.id -- If last seat is odd, keep it unchanged 4 | WHEN s.id % 2 = 0 THEN s.id - 1 -- Swap even id with previous odd id 5 | ELSE s.id + 1 -- Swap odd id with next even id 6 | END AS id, 7 | student 8 | FROM Seat AS s 9 | ORDER BY id; 10 | -------------------------------------------------------------------------------- /782-jewels-and-stones/jewels-and-stones.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution: 4 | def numJewelsInStones(self, jewels: str, stones: str) -> int: 5 | # Count occurrences of each stone 6 | stone_counts = Counter(stones) 7 | 8 | # Sum the counts of stones that are jewels 9 | return sum(stone_counts[jewel] for jewel in jewels) 10 | -------------------------------------------------------------------------------- /3392-find-trending-hashtags/find-trending-hashtags.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | CONCAT("#", SUBSTRING_INDEX(SUBSTRING_INDEX(tweet, '#', -1), ' ', 1)) AS hashtag, 3 | COUNT(*) AS hashtag_count 4 | FROM 5 | Tweets 6 | WHERE 7 | YEAR(tweet_date) = 2024 AND 8 | MONTH(tweet_date) = 2 9 | GROUP BY 10 | hashtag 11 | ORDER BY 12 | hashtag_count DESC, 13 | hashtag DESC 14 | LIMIT 3; 15 | -------------------------------------------------------------------------------- /1317-monthly-transactions-i/monthly-transactions-i.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | DATE_FORMAT(trans_date, '%Y-%m') AS month, 3 | country, 4 | COUNT(*) AS trans_count, 5 | SUM(state = 'approved') AS approved_count, 6 | SUM(amount) AS trans_total_amount, 7 | SUM(CASE WHEN state = 'approved' THEN amount ELSE 0 END) AS approved_total_amount 8 | FROM transactions 9 | GROUP BY month, country; 10 | -------------------------------------------------------------------------------- /3365-find-all-unique-email-domains/find-all-unique-email-domains.sql: -------------------------------------------------------------------------------- 1 | -- Main query to find all unique email domains ending with .com and their counts 2 | SELECT 3 | SUBSTRING_INDEX(email, '@', -1) AS email_domain, 4 | COUNT(*) AS count 5 | FROM 6 | Emails 7 | WHERE 8 | SUBSTRING_INDEX(email, '.', -1) = 'com' 9 | GROUP BY 10 | email_domain 11 | ORDER BY 12 | email_domain ASC; 13 | -------------------------------------------------------------------------------- /1942-primary-department-for-each-employee/primary-department-for-each-employee.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | employee_id, 3 | MAX(department_id) AS department_id 4 | FROM 5 | Employee 6 | GROUP BY 7 | employee_id 8 | HAVING 9 | COUNT(department_id) = 1 10 | 11 | UNION 12 | 13 | SELECT 14 | employee_id, 15 | department_id 16 | FROM 17 | Employee 18 | WHERE 19 | primary_flag = 'Y'; 20 | -------------------------------------------------------------------------------- /58-length-of-last-word/length-of-last-word.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def lengthOfLastWord(self, s: str) -> int: 3 | # Split the string by whitespace 4 | words = re.split(r"\s+", s) 5 | 6 | # Determine the index of the last word 7 | last_word_idx = -1 if words[-1] else -2 8 | 9 | # Return the length of the last word 10 | return len(words[last_word_idx]) 11 | -------------------------------------------------------------------------------- /3371-harshad-number/harshad-number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sumOfTheDigitsOfHarshadNumber(self, x: int) -> int: 3 | # Calculate the sum of the digits of x 4 | digit_sum = sum(map(int, str(x))) 5 | 6 | # Check if x is divisible by the sum of its digits 7 | if x % digit_sum == 0: 8 | return digit_sum 9 | else: 10 | return -1 11 | 12 | -------------------------------------------------------------------------------- /3481-second-day-verification/second-day-verification.sql: -------------------------------------------------------------------------------- 1 | -- Main query to find user IDs who verified their sign-up on the second day 2 | SELECT DISTINCT 3 | e.user_id 4 | FROM 5 | emails AS e 6 | JOIN 7 | texts AS t 8 | ON 9 | e.email_id = t.email_id 10 | WHERE 11 | t.signup_action = 'Verified' 12 | AND DATEDIFF(t.action_date, e.signup_date) = 1 13 | ORDER BY 14 | e.user_id ASC; 15 | -------------------------------------------------------------------------------- /2571-find-the-pivot-integer/find-the-pivot-integer.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def pivotInteger(self, n: int) -> int: 3 | nums = list(range(1, n+1)) 4 | total_sum = sum(nums) 5 | left_sum = 0 6 | 7 | for num in nums: 8 | total_sum -= num 9 | 10 | if left_sum == total_sum: 11 | return num 12 | 13 | left_sum += num 14 | 15 | return -1 -------------------------------------------------------------------------------- /2308-divide-array-into-equal-pairs/divide-array-into-equal-pairs.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from collections import Counter 3 | 4 | class Solution: 5 | def divideArray(self, nums: List[int]) -> bool: 6 | """Checks if the array can be divided into pairs with equal elements.""" 7 | 8 | frequency_map = Counter(nums) 9 | 10 | return all(count % 2 == 0 for count in frequency_map.values()) 11 | -------------------------------------------------------------------------------- /3258-classifying-triangles-by-lengths/classifying-triangles-by-lengths.sql: -------------------------------------------------------------------------------- 1 | -- Query to classify triangles based on side lengths 2 | SELECT 3 | CASE 4 | WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle' 5 | WHEN A = B AND B = C THEN 'Equilateral' 6 | WHEN A = B OR A = C OR B = C THEN 'Isosceles' 7 | ELSE 'Scalene' 8 | END AS triangle_type 9 | FROM 10 | Triangles; 11 | -------------------------------------------------------------------------------- /3242-count-elements-with-maximum-frequency/count-elements-with-maximum-frequency.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxFrequencyElements(self, nums: List[int]) -> int: 3 | counter = Counter(nums) 4 | max_value = max(counter.values()) 5 | result = 0 6 | 7 | for value in counter.values(): 8 | if value == max_value: 9 | result += value 10 | 11 | return result 12 | -------------------------------------------------------------------------------- /3321-type-of-triangle/type-of-triangle.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def triangleType(self, nums: List[int]) -> str: 3 | nums.sort() 4 | if nums[2] >= nums[1] + nums[0]: 5 | return "none" 6 | elif nums[0] == nums[1] == nums[2]: 7 | return "equilateral" 8 | elif nums[0] != nums[1] != nums[2]: 9 | return "scalene" 10 | else: 11 | return "isosceles" 12 | -------------------------------------------------------------------------------- /1292-immediate-food-delivery-ii/immediate-food-delivery-ii.sql: -------------------------------------------------------------------------------- 1 | SELECT ROUND(100 * AVG( 2 | CASE 3 | WHEN temp.min_order_date = temp.min_delivery_date THEN 1 4 | ELSE 0 5 | END 6 | ), 2) AS immediate_percentage 7 | FROM ( 8 | SELECT 9 | MIN(order_date) AS min_order_date, 10 | MIN(customer_pref_delivery_date) AS min_delivery_date 11 | FROM delivery 12 | GROUP BY customer_id 13 | ) AS temp 14 | -------------------------------------------------------------------------------- /2859-add-two-promises/add-two-promises.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Promise} promise1 3 | * @param {Promise} promise2 4 | * @return {Promise} 5 | */ 6 | var addTwoPromises = async function(promise1, promise2) { 7 | return Promise.all([promise1, promise2]).then(arr => arr.reduce((a, b) => a+b), error => console.log(error)); 8 | }; 9 | 10 | /** 11 | * addTwoPromises(Promise.resolve(2), Promise.resolve(2)) 12 | * .then(console.log); // 4 13 | */ -------------------------------------------------------------------------------- /1801-average-time-of-process-per-machine/average-time-of-process-per-machine.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | a1.machine_id, 3 | ROUND(AVG(a2.timestamp - a1.timestamp), 3) AS processing_time 4 | FROM 5 | Activity a1 6 | JOIN 7 | Activity a2 8 | ON 9 | a1.machine_id = a2.machine_id 10 | AND a1.process_id = a2.process_id 11 | AND a1.activity_type = 'start' 12 | AND a2.activity_type = 'end' 13 | GROUP BY 14 | a1.machine_id; 15 | -------------------------------------------------------------------------------- /2741-function-composition/function-composition.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Function[]} functions 3 | * @return {Function} 4 | */ 5 | var compose = function(functions) { 6 | 7 | return function(x) { 8 | res = x 9 | for (let i = functions.length-1; i > -1; i--) 10 | res = functions[i](res) 11 | return res 12 | } 13 | }; 14 | 15 | /** 16 | * const fn = compose([x => x + 1, x => 2 * x]) 17 | * fn(4) // 9 18 | */ -------------------------------------------------------------------------------- /2885-count-occurrences-in-text/count-occurrences-in-text.sql: -------------------------------------------------------------------------------- 1 | WITH bull_files AS ( 2 | SELECT DISTINCT file_name 3 | FROM files 4 | WHERE LOWER(content) LIKE '% bull %' 5 | ), 6 | bear_files AS ( 7 | SELECT DISTINCT file_name 8 | FROM files 9 | WHERE LOWER(content) LIKE '% bear %' 10 | ) 11 | 12 | SELECT 'bull' AS word, COUNT(*) AS count 13 | FROM bull_files 14 | UNION ALL 15 | SELECT 'bear', COUNT(*) 16 | FROM bear_files; 17 | -------------------------------------------------------------------------------- /178-rank-scores/rank-scores.sql: -------------------------------------------------------------------------------- 1 | -- Select the score and calculate the dense rank for each score 2 | -- using the DENSE_RANK() function to ensure that identical scores get the same rank 3 | -- and no gaps in ranking for identical scores 4 | SELECT 5 | score, 6 | DENSE_RANK() OVER (ORDER BY score DESC) AS "rank" 7 | FROM 8 | scores 9 | -- Order the result by score in descending order to match the ranking 10 | ORDER BY 11 | score DESC; 12 | -------------------------------------------------------------------------------- /1850-minimum-length-of-string-after-deleting-similar-ends/minimum-length-of-string-after-deleting-similar-ends.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minimumLength(self, s: str) -> int: 3 | l, r = 0, len(s)-1 4 | while l < r and s[l] == s[r]: 5 | letter = s[l] 6 | while l < len(s) and letter == s[l]: 7 | l += 1 8 | while l < r and letter == s[r]: 9 | r -= 1 10 | return r-l+1 -------------------------------------------------------------------------------- /2048-build-array-from-permutation/build-array-from-permutation.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def buildArray(self, nums: List[int]) -> List[int]: 5 | """ 6 | Constructs a new array such that result[i] = nums[nums[i]] for each index i. 7 | """ 8 | n = len(nums) 9 | result = [0] * n 10 | 11 | for i in range(n): 12 | result[i] = nums[nums[i]] 13 | 14 | return result 15 | -------------------------------------------------------------------------------- /2502-sort-the-people/sort-the-people.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sortPeople(self, names: List[str], heights: List[int]) -> List[str]: 3 | # Combine heights and names into a list of tuples 4 | persons = list(zip(heights, names)) 5 | # Sort the list of tuples in descending order based on heights 6 | persons.sort(reverse=True) 7 | # Extract the names from the sorted list of tuples 8 | return [name for height, name in persons] 9 | -------------------------------------------------------------------------------- /2837-minimum-operations-to-make-the-integer-zero/minimum-operations-to-make-the-integer-zero.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def makeTheIntegerZero(self, num1: int, num2: int) -> int: 3 | for k in range(1, 61): 4 | S = num1 - k * num2 5 | if S < 0: 6 | continue 7 | # Check if S can be formed with exactly k powers of 2 8 | if S.bit_count() <= k <= S: 9 | return k 10 | return -1 11 | -------------------------------------------------------------------------------- /1245-user-activity-for-the-past-30-days-i/user-activity-for-the-past-30-days-i.sql: -------------------------------------------------------------------------------- 1 | -- Count distinct active users within the last 30 days before "2019-07-27" 2 | SELECT 3 | activity_date AS day, 4 | COUNT(DISTINCT user_id) AS active_users 5 | FROM 6 | activity 7 | WHERE 8 | activity_date BETWEEN DATE_SUB("2019-07-27", INTERVAL 29 DAY) AND DATE_SUB("2019-07-27", INTERVAL 0 DAY) 9 | GROUP BY 10 | activity_date 11 | ORDER BY 12 | activity_date; 13 | -------------------------------------------------------------------------------- /1607-rectangles-area/rectangles-area.sql: -------------------------------------------------------------------------------- 1 | -- Write your MySQL query statement below 2 | SELECT 3 | p1.id AS p1, 4 | p2.id AS p2, 5 | ABS(p1.x_value - p2.x_value) * ABS(p1.y_value - p2.y_value) AS area 6 | FROM 7 | points AS p1 8 | JOIN 9 | points AS p2 ON p1.id < p2.id 10 | AND p1.x_value != p2.x_value 11 | AND p1.y_value != p2.y_value 12 | ORDER BY 13 | area DESC, 14 | p1.id ASC, 15 | p2.id ASC; 16 | -------------------------------------------------------------------------------- /1837-daily-leads-and-partners/daily-leads-and-partners.sql: -------------------------------------------------------------------------------- 1 | -- Query to select date_id, make_name, unique lead counts, and unique partner counts 2 | SELECT 3 | date_id, 4 | make_name, 5 | COUNT(DISTINCT lead_id) AS unique_leads, -- Count distinct leads 6 | COUNT(DISTINCT partner_id) AS unique_partners -- Count distinct partners 7 | FROM 8 | DailySales 9 | -- Group the result by date_id and make_name 10 | GROUP BY 11 | date_id, 12 | make_name; 13 | -------------------------------------------------------------------------------- /2098-all-the-pairs-with-the-maximum-number-of-common-followers/all-the-pairs-with-the-maximum-number-of-common-followers.sql: -------------------------------------------------------------------------------- 1 | WITH counts AS ( 2 | SELECT r1.user_id AS u1, r2.user_id AS u2, COUNT(r1.follower_id) AS c 3 | FROM relations AS r1 4 | JOIN relations AS r2 ON r1.user_id < r2.user_id AND r1.follower_id = r2.follower_id 5 | GROUP BY u1, u2 6 | ) 7 | 8 | SELECT u1 AS user1_id, u2 AS user2_id 9 | FROM counts 10 | WHERE c = (SELECT MAX(c) FROM counts); 11 | -------------------------------------------------------------------------------- /1137-height-checker/height-checker.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def heightChecker(self, heights: List[int]) -> int: 5 | count = 0 6 | sorted_heights = sorted(heights) # Create a sorted version of heights 7 | for i in range(len(heights)): 8 | if sorted_heights[i] != heights[i]: # Compare the sorted list with the original list 9 | count += 1 # Increment count for each mismatch 10 | return count 11 | -------------------------------------------------------------------------------- /3287-loan-types/loan-types.sql: -------------------------------------------------------------------------------- 1 | -- Query to select users who have both "Refinance" and "Mortgage" loan types 2 | SELECT 3 | user_id 4 | FROM 5 | loans 6 | GROUP BY 7 | user_id 8 | HAVING 9 | SUM(loan_type = 'Refinance') > 0 -- Check if the user has at least one "Refinance" loan 10 | AND SUM(loan_type = 'Mortgage') > 0 -- Check if the user has at least one "Mortgage" loan 11 | ORDER BY 12 | user_id ASC; -- Order the result by user_id in ascending order 13 | -------------------------------------------------------------------------------- /1720-crawler-log-folder/crawler-log-folder.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minOperations(self, logs: List[str]) -> int: 3 | depth = 0 4 | for log in logs: 5 | if log == "./": 6 | continue 7 | elif log == "../": 8 | if depth > 0: 9 | depth -= 1 10 | else: 11 | depth = 0 12 | else: 13 | depth += 1 14 | 15 | return depth 16 | -------------------------------------------------------------------------------- /3253-symmetric-coordinates/symmetric-coordinates.sql: -------------------------------------------------------------------------------- 1 | WITH coordinates_with_rn AS ( 2 | SELECT x, y, ROW_NUMBER() OVER () AS rn 3 | FROM Coordinates 4 | ) 5 | 6 | -- Main query to find symmetric pairs and ensure x <= y 7 | SELECT DISTINCT 8 | c1.x, c1.y 9 | FROM 10 | coordinates_with_rn AS c1 11 | JOIN 12 | coordinates_with_rn AS c2 13 | ON 14 | c1.x = c2.y AND c1.y = c2.x AND c1.rn != c2.rn 15 | WHERE 16 | c1.x <= c1.y 17 | ORDER BY 18 | c1.x, c1.y; 19 | -------------------------------------------------------------------------------- /1494-activity-participants/activity-participants.sql: -------------------------------------------------------------------------------- 1 | WITH counts AS ( 2 | SELECT activity, COUNT(*) AS c 3 | FROM friends 4 | GROUP BY activity 5 | ), 6 | ext AS ( 7 | SELECT activity 8 | FROM counts 9 | WHERE c = (SELECT MAX(c) FROM counts) 10 | UNION 11 | SELECT activity 12 | FROM counts 13 | WHERE c = (SELECT MIN(c) FROM counts) 14 | ) 15 | 16 | SELECT name AS activity 17 | FROM activities 18 | WHERE name NOT IN (SELECT activity FROM ext); 19 | -------------------------------------------------------------------------------- /1495-number-of-trusted-contacts-of-a-customer/number-of-trusted-contacts-of-a-customer.sql: -------------------------------------------------------------------------------- 1 | SELECT i.invoice_id, c.customer_name, i.price, COUNT(co.contact_name) AS contacts_cnt, 2 | COALESCE(SUM(CASE WHEN co.contact_email IN (SELECT email FROM customers) THEN 1 ELSE 0 END), 0) AS trusted_contacts_cnt 3 | FROM invoices AS i 4 | LEFT JOIN customers AS c ON i.user_id = c.customer_id 5 | LEFT JOIN contacts AS co ON c.customer_id = co.user_id 6 | GROUP BY i.invoice_id 7 | ORDER BY i.invoice_id; 8 | -------------------------------------------------------------------------------- /1019-squares-of-a-sorted-array/squares-of-a-sorted-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def sortedSquares(self, nums: List[int]) -> List[int]: 3 | n = len(nums) 4 | res = [0] * n 5 | i, j = 0, n - 1 6 | for k in range(n - 1, -1, -1): 7 | if abs(nums[i]) > abs(nums[j]): 8 | res[k] = nums[i] ** 2 9 | i += 1 10 | else: 11 | res[k] = nums[j] ** 2 12 | j -= 1 13 | return res 14 | -------------------------------------------------------------------------------- /759-set-intersection-size-at-least-two/set-intersection-size-at-least-two.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def intersectionSizeTwo(self, intervals: List[List[int]]) -> int: 3 | intervals.sort(key=lambda x: (x[1], -x[0])) 4 | 5 | nums = [] 6 | 7 | for start, end in intervals: 8 | if not nums or nums[-1] < start: 9 | nums.extend([end - 1, end]) 10 | elif nums[-2] < start: 11 | nums.append(end) 12 | 13 | return len(nums) -------------------------------------------------------------------------------- /982-minimum-increment-to-make-array-unique/minimum-increment-to-make-array-unique.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minIncrementForUnique(self, nums: List[int]) -> int: 3 | nums.sort() 4 | running_max = nums[0] 5 | inc_count = 0 6 | 7 | for num in nums[1:]: 8 | if num <= running_max: 9 | inc_count += running_max - num + 1 10 | num = running_max + 1 11 | running_max = num 12 | 13 | return inc_count 14 | -------------------------------------------------------------------------------- /122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxProfit(self, prices: List[int]) -> int: 3 | profit = 0 # Initialize profit to 0 4 | # Iterate through the prices 5 | for i in range(1, len(prices)): 6 | # Add the positive difference between consecutive prices to profit 7 | profit += max(0, prices[i] - prices[i-1]) 8 | return profit # Return the total profit 9 | 10 | 11 | -------------------------------------------------------------------------------- /1448-maximum-69-number/maximum-69-number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maximum69Number(self, num: int) -> int: 3 | """ 4 | Converts the first '6' in the number to a '9' to form the largest possible number. 5 | """ 6 | digits = list(str(num)) 7 | 8 | for i, digit in enumerate(digits): 9 | if digit == '6': 10 | digits[i] = '9' 11 | break # Only convert the first '6' found 12 | 13 | return int("".join(digits)) 14 | -------------------------------------------------------------------------------- /2252-the-airport-with-the-most-traffic/the-airport-with-the-most-traffic.sql: -------------------------------------------------------------------------------- 1 | WITH counts AS ( 2 | SELECT departure_airport AS airport, flights_count FROM flights 3 | UNION ALL 4 | SELECT arrival_airport AS airport, flights_count FROM flights 5 | ), 6 | grpd_counts AS ( 7 | SELECT airport, SUM(flights_count) AS total_flights FROM counts GROUP BY airport 8 | ) 9 | SELECT airport AS airport_id 10 | FROM grpd_counts 11 | WHERE total_flights = (SELECT MAX(total_flights) FROM grpd_counts); 12 | -------------------------------------------------------------------------------- /1227-number-of-equivalent-domino-pairs/number-of-equivalent-domino-pairs.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def numEquivDominoPairs(self, dominoes: List[List[int]]) -> int: 3 | domino_counts = defaultdict(int) 4 | 5 | for domino in dominoes: 6 | domino_counts["".join(map(str, sorted(domino)))] += 1 7 | 8 | pair_count = 0 9 | 10 | for value in domino_counts.values(): 11 | pair_count += (value * (value - 1)) // 2 12 | 13 | return pair_count 14 | -------------------------------------------------------------------------------- /2743-debounce/debounce.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Function} fn 3 | * @param {number} t milliseconds 4 | * @return {Function} 5 | */ 6 | var debounce = function(fn, t) { 7 | let timeout; 8 | return function(...args) { 9 | clearTimeout(timeout); 10 | timeout = setTimeout(()=>fn(...args), t); 11 | } 12 | }; 13 | 14 | /** 15 | * const log = debounce(console.log, 100); 16 | * log('Hello'); // cancelled 17 | * log('Hello'); // cancelled 18 | * log('Hello'); // Logged at t=100ms 19 | */ -------------------------------------------------------------------------------- /209-minimum-size-subarray-sum/minimum-size-subarray-sum.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minSubArrayLen(self, target: int, nums: List[int]) -> int: 3 | l = 0 4 | min_len = float("inf") 5 | sum_val = 0 6 | for r in range(len(nums)): 7 | sum_val += nums[r] 8 | while sum_val >= target: 9 | min_len = min(min_len, r - l + 1) 10 | sum_val -= nums[l] 11 | l += 1 12 | return min_len if min_len != float("inf") else 0 -------------------------------------------------------------------------------- /2789-counter-ii/counter-ii.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {integer} init 3 | * @return { increment: Function, decrement: Function, reset: Function } 4 | */ 5 | var createCounter = function(init) { 6 | var cur = init; 7 | return { 8 | increment: () => ++cur, 9 | decrement: () => --cur, 10 | reset: () => cur = init 11 | }; 12 | }; 13 | 14 | /** 15 | * const counter = createCounter(5) 16 | * counter.increment(); // 6 17 | * counter.reset(); // 5 18 | * counter.decrement(); // 4 19 | */ -------------------------------------------------------------------------------- /350-intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution: 4 | def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: 5 | # Compute the intersection of nums1 and nums2 using Counter objects 6 | intersection = Counter(nums1) & Counter(nums2) 7 | # Construct a list containing elements from the intersection along with their multiplicities 8 | return [key for key in intersection for _ in range(intersection[key])] 9 | -------------------------------------------------------------------------------- /1259-article-views-ii/article-views-ii.sql: -------------------------------------------------------------------------------- 1 | -- Select viewer IDs from the "views" table 2 | SELECT 3 | DISTINCT viewer_id AS id -- Alias viewer_id as id 4 | FROM 5 | views 6 | -- Group the results by view date and viewer ID 7 | GROUP BY 8 | view_date, 9 | viewer_id 10 | -- Filter the groups where the count of distinct article IDs is greater than 1 11 | HAVING 12 | COUNT(DISTINCT article_id) > 1 13 | -- Order the results by viewer ID in ascending order 14 | ORDER BY 15 | viewer_id ASC; 16 | -------------------------------------------------------------------------------- /1878-check-if-array-is-sorted-and-rotated/check-if-array-is-sorted-and-rotated.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def check(self, nums: List[int]) -> bool: 3 | count_breaks = 0 4 | n = len(nums) 5 | 6 | for i in range(n): 7 | if nums[i] > nums[(i + 1) % n]: # Check breakpoints (consider circular array) 8 | count_breaks += 1 9 | if count_breaks > 1: # More than one break → not a rotated sorted array 10 | return False 11 | 12 | return True 13 | -------------------------------------------------------------------------------- /217-contains-duplicate/contains-duplicate.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def containsDuplicate(self, nums: List[int]) -> bool: 3 | visited = set() # Initialize a set to store visited numbers 4 | # Iterate through the list 5 | for num in nums: 6 | if num in visited: # If the number has been visited before, return True 7 | return True 8 | visited.add(num) # Add the number to the set of visited numbers 9 | return False # If no duplicates found, return False 10 | -------------------------------------------------------------------------------- /1224-minimum-falling-path-sum-ii/minimum-falling-path-sum-ii.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minFallingPathSum(self, grid: List[List[int]]) -> int: 3 | @cache 4 | def dfs(prev, row): 5 | if row == len(grid): 6 | return 0 7 | min_val = float("inf") 8 | for col in range(len(grid[0])): 9 | if col != prev: 10 | min_val = min(min_val, grid[row][col] + dfs(col, row+1)) 11 | return min_val 12 | return dfs(-1, 0) 13 | -------------------------------------------------------------------------------- /2796-allow-one-function-call/allow-one-function-call.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Function} fn 3 | * @return {Function} 4 | */ 5 | var once = function(fn) { 6 | let callable = true; 7 | return function(...args){ 8 | if (callable) { 9 | callable = false; 10 | return fn(...args) 11 | } 12 | } 13 | }; 14 | 15 | /** 16 | * let fn = (a,b,c) => (a + b + c) 17 | * let onceFn = once(fn) 18 | * 19 | * onceFn(1,2,3); // 6 20 | * onceFn(2,3,6); // returns undefined without calling fn 21 | */ 22 | -------------------------------------------------------------------------------- /141-linked-list-cycle/linked-list-cycle.py: -------------------------------------------------------------------------------- 1 | # Definition for singly-linked list. 2 | # class ListNode: 3 | # def __init__(self, x): 4 | # self.val = x 5 | # self.next = None 6 | 7 | class Solution: 8 | def hasCycle(self, head: Optional[ListNode]) -> bool: 9 | slow = head 10 | fast = head 11 | while fast and fast.next: 12 | slow = slow.next 13 | fast = fast.next.next 14 | if slow == fast: 15 | return True 16 | return False 17 | -------------------------------------------------------------------------------- /1415-students-and-examinations/students-and-examinations.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | s.student_id, 3 | s.student_name, 4 | sub.subject_name, 5 | COUNT(e.student_id) AS attended_exams 6 | FROM 7 | Students s 8 | CROSS JOIN 9 | Subjects sub 10 | LEFT JOIN 11 | Examinations e 12 | ON 13 | s.student_id = e.student_id 14 | AND sub.subject_name = e.subject_name 15 | GROUP BY 16 | s.student_id, 17 | s.student_name, 18 | sub.subject_name 19 | ORDER BY 20 | s.student_id, 21 | sub.subject_name; 22 | -------------------------------------------------------------------------------- /2315-the-change-in-global-rankings/the-change-in-global-rankings.sql: -------------------------------------------------------------------------------- 1 | WITH ranks AS ( 2 | SELECT 3 | team_id, 4 | name, 5 | CAST(rank() OVER (ORDER BY points DESC, name ASC) AS SIGNED) AS rank1, 6 | CAST(rank() OVER (ORDER BY (points + points_change) DESC, name ASC) AS SIGNED) AS rank2 7 | FROM 8 | teampoints AS t 9 | JOIN 10 | pointschange AS p USING (team_id) 11 | ) 12 | SELECT 13 | team_id, 14 | name, 15 | rank1 - rank2 AS rank_diff 16 | FROM 17 | ranks; 18 | -------------------------------------------------------------------------------- /3422-find-the-n-th-value-after-k-seconds/find-the-n-th-value-after-k-seconds.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def valueAfterKSeconds(self, n: int, k: int) -> int: 3 | MOD = 10**9 + 7 4 | values = [1] * n # Initialize the list with 1's 5 | 6 | for _ in range(k): 7 | for i in range(1, n): 8 | values[i] = (values[i] + values[i-1]) % MOD # Update the current value with the sum of the previous values modulo MOD 9 | 10 | return values[-1] % MOD # Return the last value in the list modulo MOD 11 | -------------------------------------------------------------------------------- /2014-orders-with-maximum-quantity-above-average/orders-with-maximum-quantity-above-average.sql: -------------------------------------------------------------------------------- 1 | WITH max_avg_quantity_per_order AS ( 2 | SELECT order_id, MAX(quantity) AS max_quantity, AVG(quantity) AS avg_quantity 3 | FROM ordersdetails 4 | GROUP BY order_id 5 | ), 6 | max_average_quantity AS ( 7 | SELECT MAX(avg_quantity) AS max_avg_quantity 8 | FROM max_avg_quantity_per_order 9 | ) 10 | 11 | SELECT order_id 12 | FROM max_avg_quantity_per_order 13 | WHERE max_quantity > (SELECT max_avg_quantity FROM max_average_quantity); 14 | -------------------------------------------------------------------------------- /1054-complement-of-base-10-integer/complement-of-base-10-integer.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def bitwiseComplement(self, n: int) -> int: 3 | if n == 0: 4 | return 1 5 | 6 | # Calculate the number of bits required to represent 'n' 7 | num_bits = n.bit_length() 8 | 9 | # Create a bitmask with all bits set to 1 of the same length as 'n' 10 | bitmask = (1 << num_bits) - 1 11 | 12 | # The complement of 'n' is the XOR of 'n' with this bitmask 13 | return bitmask ^ n 14 | -------------------------------------------------------------------------------- /26-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def removeDuplicates(self, nums: List[int]) -> int: 3 | k = 0 # Initialize pointer k 4 | # Iterate through the list 5 | for i in range(1, len(nums)): 6 | # If current number is different from previous number, update nums[k+1] and increment k 7 | if nums[k] != nums[i]: 8 | nums[k + 1] = nums[i] 9 | k += 1 10 | return k + 1 # Return the length of the modified list 11 | -------------------------------------------------------------------------------- /2478-longest-nice-subarray/longest-nice-subarray.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def longestNiceSubarray(self, nums: List[int]) -> int: 5 | left = 0 6 | bitwise_and = 0 7 | max_len = 0 8 | 9 | for right in range(len(nums)): 10 | while (bitwise_and & nums[right]) != 0: 11 | bitwise_and ^= nums[left] 12 | left += 1 13 | 14 | bitwise_and ^= nums[right] 15 | max_len = max(max_len, right - left + 1) 16 | 17 | return max_len 18 | -------------------------------------------------------------------------------- /2742-group-by/group-by.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {Function} fn 3 | * @return {Object} 4 | */ 5 | Array.prototype.groupBy = function(fn) { 6 | const map = new Map(); 7 | for (let e of this) { 8 | let key = fn(e); 9 | if (!map.has(key)) 10 | map.set(key, []); 11 | map.get(key).push(e) 12 | } 13 | const array = {} 14 | for (let [key, val] of map) 15 | array[key] = val; 16 | return array; 17 | 18 | 19 | }; 20 | 21 | /** 22 | * [1,2,3].groupBy(String) // {"1":[1],"2":[2],"3":[3]} 23 | */ -------------------------------------------------------------------------------- /344-reverse-string/reverse-string.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def reverseString(self, s: List[str]) -> None: 5 | """ 6 | Reverses the given list of characters in-place. 7 | 8 | Args: 9 | - s: List of characters 10 | 11 | Returns: 12 | - None 13 | """ 14 | # Iterate through the first half of the list 15 | for i in range(len(s) // 2): 16 | # Swap characters at opposite positions 17 | s[i], s[len(s) - 1 - i] = s[len(s) - 1 - i], s[i] 18 | -------------------------------------------------------------------------------- /607-sales-person/sales-person.sql: -------------------------------------------------------------------------------- 1 | -- Select the names of salespeople who did not sell to company 'RED' 2 | SELECT 3 | s.name 4 | FROM 5 | salesperson s 6 | -- Use a subquery to find all sales_ids who sold to company 'RED' 7 | WHERE 8 | s.sales_id NOT IN ( 9 | SELECT 10 | o.sales_id 11 | FROM 12 | orders o 13 | LEFT JOIN 14 | company c ON o.com_id = c.com_id 15 | -- Only include records where the company name is 'RED' 16 | WHERE 17 | c.name = 'RED' 18 | ); 19 | -------------------------------------------------------------------------------- /966-binary-subarrays-with-sum/binary-subarrays-with-sum.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def numSubarraysWithSum(self, nums: List[int], goal: int) -> int: 3 | prefix_sums = defaultdict(int) 4 | prefix_sums[0] = 1 5 | 6 | running_sum = 0 7 | result = 0 8 | 9 | for num in nums: 10 | running_sum += num 11 | if (running_sum - goal) in prefix_sums: 12 | result += prefix_sums[(running_sum - goal)] 13 | prefix_sums[running_sum] += 1 14 | 15 | return result 16 | -------------------------------------------------------------------------------- /2640-maximum-number-of-integers-to-choose-from-a-range-i/maximum-number-of-integers-to-choose-from-a-range-i.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxCount(self, banned: List[int], n: int, maxSum: int) -> int: 3 | current_sum = 0 4 | banned_set = set(banned) 5 | count = 0 6 | 7 | for number in range(1, n + 1): 8 | if number not in banned_set: 9 | current_sum += number 10 | if current_sum > maxSum: 11 | return count 12 | count += 1 13 | 14 | return count 15 | -------------------------------------------------------------------------------- /3788-maximum-unique-subarray-sum-after-deletion/maximum-unique-subarray-sum-after-deletion.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def maxSum(self, nums: List[int]) -> int: 5 | """ 6 | Returns the sum of unique non-negative numbers in the list. 7 | If all numbers are negative, returns the maximum number. 8 | """ 9 | non_negative_nums = {num for num in nums if num >= 0} 10 | 11 | if non_negative_nums: 12 | return sum(non_negative_nums) 13 | else: 14 | return max(nums) 15 | -------------------------------------------------------------------------------- /1411-convert-binary-number-in-a-linked-list-to-integer/convert-binary-number-in-a-linked-list-to-integer.py: -------------------------------------------------------------------------------- 1 | # Definition for singly-linked list. 2 | # class ListNode: 3 | # def __init__(self, val=0, next=None): 4 | # self.val = val 5 | # self.next = next 6 | class Solution: 7 | def getDecimalValue(self, head: Optional[ListNode]) -> int: 8 | num_str = [] 9 | 10 | cur = head 11 | 12 | while cur: 13 | num_str.append(str(cur.val)) 14 | cur = cur.next 15 | 16 | return int("".join(num_str), 2) 17 | -------------------------------------------------------------------------------- /2148-minimum-number-of-moves-to-seat-everyone/minimum-number-of-moves-to-seat-everyone.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def minMovesToSeat(self, seats: List[int], students: List[int]) -> int: 5 | seats.sort() # Sort the seats array 6 | students.sort() # Sort the students array 7 | 8 | moves = 0 9 | 10 | # Calculate the total moves required by matching each student to the closest seat 11 | for seat, student in zip(seats, students): 12 | moves += abs(seat - student) 13 | 14 | return moves 15 | -------------------------------------------------------------------------------- /3195-separate-black-and-white-balls/separate-black-and-white-balls.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minimumSteps(self, s: str) -> int: 3 | swaps = 0 4 | left_black_count = 1 # Count of '1's from the left side 5 | 6 | # Traverse the string from right to left 7 | for i in range(len(s) - 1, -1, -1): 8 | if s[i] == "1": 9 | # Calculate swaps needed and update the left_black_count 10 | swaps += (len(s) - left_black_count - i) 11 | left_black_count += 1 12 | 13 | return swaps 14 | -------------------------------------------------------------------------------- /359-logger-rate-limiter/logger-rate-limiter.py: -------------------------------------------------------------------------------- 1 | class Logger: 2 | 3 | def __init__(self): 4 | self.min_times = defaultdict(int) 5 | 6 | 7 | def shouldPrintMessage(self, timestamp: int, message: str) -> bool: 8 | if self.min_times[message] > timestamp: 9 | return False 10 | else: 11 | self.min_times[message] = timestamp + 10 12 | return True 13 | 14 | 15 | # Your Logger object will be instantiated and called as such: 16 | # obj = Logger() 17 | # param_1 = obj.shouldPrintMessage(timestamp,message) -------------------------------------------------------------------------------- /3256-find-candidates-for-data-scientist-position/find-candidates-for-data-scientist-position.sql: -------------------------------------------------------------------------------- 1 | -- Main query to find candidate IDs who have skills in Python, Tableau, and PostgreSQL 2 | SELECT 3 | c1.candidate_id 4 | FROM 5 | candidates AS c1 6 | JOIN 7 | candidates AS c2 8 | ON 9 | c1.candidate_id = c2.candidate_id 10 | AND c1.skill = 'Python' 11 | AND c2.skill = 'Tableau' 12 | JOIN 13 | candidates AS c3 14 | ON 15 | c1.candidate_id = c3.candidate_id 16 | AND c3.skill = 'PostgreSQL' 17 | ORDER BY 18 | c1.candidate_id ASC; 19 | -------------------------------------------------------------------------------- /185-department-top-three-salaries/department-top-three-salaries.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | d.name AS department, 3 | e1.name AS employee, 4 | e1.salary AS salary 5 | FROM 6 | employee AS e1 7 | INNER JOIN 8 | department AS d 9 | ON e1.departmentID = d.id 10 | WHERE 11 | ( 12 | SELECT 13 | COUNT(DISTINCT e2.salary) 14 | FROM 15 | employee AS e2 16 | WHERE 17 | e2.departmentID = e1.departmentID 18 | AND e2.salary > e1.salary 19 | ) < 3 20 | ORDER BY 21 | d.name, 22 | e1.salary DESC; 23 | -------------------------------------------------------------------------------- /2451-product-sales-analysis-iv/product-sales-analysis-iv.sql: -------------------------------------------------------------------------------- 1 | WITH UserSpending AS ( 2 | SELECT 3 | s.user_id, 4 | s.product_id, 5 | SUM(s.quantity * p.price) AS total_spending, 6 | RANK() OVER (PARTITION BY s.user_id ORDER BY SUM(s.quantity * p.price) DESC) AS rank_by_spending 7 | FROM 8 | Sales s 9 | JOIN 10 | Product p USING(product_id) 11 | GROUP BY 12 | s.user_id, s.product_id 13 | ) 14 | SELECT 15 | user_id, 16 | product_id 17 | FROM 18 | UserSpending 19 | WHERE 20 | rank_by_spending = 1; 21 | -------------------------------------------------------------------------------- /900-reordered-power-of-2/reordered-power-of-2.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reorderedPowerOf2(self, n: int) -> bool: 3 | # Helper: returns sorted string of digits for a number 4 | def signature(x: int) -> str: 5 | return ''.join(sorted(str(x))) 6 | 7 | # Precompute signatures of all powers of two up to 10^9 8 | power_signatures = {signature(1 << k) for k in range(31)} # 2^0 .. 2^30 9 | 10 | # Check if n's signature matches any precomputed power-of-two signature 11 | return signature(n) in power_signatures 12 | -------------------------------------------------------------------------------- /1298-reverse-substrings-between-each-pair-of-parentheses/reverse-substrings-between-each-pair-of-parentheses.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reverseParentheses(self, s: str) -> str: 3 | stack = [] 4 | for char in s: 5 | if char == ")": 6 | reversed_word = [] 7 | while stack[-1] != "(": 8 | reversed_word.append(stack.pop()[::-1]) 9 | stack.pop() 10 | stack.append("".join(reversed_word)) 11 | else: 12 | stack.append(char) 13 | 14 | return "".join(stack) -------------------------------------------------------------------------------- /525-contiguous-array/contiguous-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def findMaxLength(self, nums: List[int]) -> int: 3 | prefix_sum = defaultdict(int) 4 | prefix_sum[0] = -1 5 | running_sum = 0 6 | max_len = 0 7 | 8 | for i, num in enumerate(nums): 9 | running_sum += 1 if num == 1 else -1 10 | if running_sum in prefix_sum: 11 | max_len = max(max_len, i - prefix_sum[running_sum]) 12 | else: 13 | prefix_sum[running_sum] = i 14 | 15 | return max_len 16 | 17 | -------------------------------------------------------------------------------- /3621-minimum-operations-to-make-array-values-equal-to-k/minimum-operations-to-make-array-values-equal-to-k.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def minOperations(self, nums: List[int], k: int) -> int: 5 | """ 6 | Counts how many unique numbers in the list are strictly greater than k. 7 | If any number in nums is less than k, return -1. 8 | """ 9 | if any(num < k for num in nums): 10 | return -1 11 | 12 | unique_greater_than_k = sum(1 for num in set(nums) if num > k) 13 | return unique_greater_than_k 14 | -------------------------------------------------------------------------------- /614-second-degree-follower/second-degree-follower.sql: -------------------------------------------------------------------------------- 1 | -- CTE to find second-degree followers 2 | WITH second_degree_followers AS ( 3 | SELECT DISTINCT f1.followee AS person 4 | FROM follow AS f1 5 | JOIN follow AS f2 ON f1.followee = f2.follower 6 | ) 7 | 8 | -- Main query to count the number of followers for each second-degree follower 9 | SELECT 10 | followee AS follower, 11 | COUNT(follower) AS num 12 | FROM 13 | follow 14 | WHERE 15 | followee IN (SELECT person FROM second_degree_followers) 16 | GROUP BY 17 | followee 18 | ORDER BY 19 | follower ASC; 20 | -------------------------------------------------------------------------------- /816-design-hashset/design-hashset.py: -------------------------------------------------------------------------------- 1 | class MyHashSet: 2 | 3 | def __init__(self): 4 | self.arr = [False] * (10**6+1) 5 | 6 | 7 | def add(self, key: int) -> None: 8 | self.arr[key] = True 9 | 10 | def remove(self, key: int) -> None: 11 | self.arr[key] = False 12 | 13 | 14 | def contains(self, key: int) -> bool: 15 | return self.arr[key] 16 | 17 | 18 | 19 | # Your MyHashSet object will be instantiated and called as such: 20 | # obj = MyHashSet() 21 | # obj.add(key) 22 | # obj.remove(key) 23 | # param_3 = obj.contains(key) -------------------------------------------------------------------------------- /342-power-of-four/power-of-four.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPowerOfFour(self, n: int) -> bool: 3 | # If 'n' is 1, it is a power of four 4 | if n == 1: 5 | return True 6 | 7 | # If 'n' is non-positive, it cannot be a power of four 8 | if n <= 0: 9 | return False 10 | 11 | # Calculate the logarithm of 'n' with base 4 12 | logarithm_base4 = math.log(n) / math.log(4) 13 | 14 | # Check if the result of the logarithmic operation is an integer 15 | return (logarithm_base4 == int(logarithm_base4)) -------------------------------------------------------------------------------- /177-nth-highest-salary/nth-highest-salary.sql: -------------------------------------------------------------------------------- 1 | CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT 2 | BEGIN 3 | -- Declare a variable M which will store the value of N-1, used for the LIMIT clause 4 | DECLARE M INT; 5 | SET M = N - 1; 6 | 7 | -- Return the Nth highest salary 8 | RETURN ( 9 | SELECT DISTINCT salary 10 | FROM Employee 11 | -- Order salaries in descending order to get the highest salary first 12 | ORDER BY salary DESC 13 | -- Skip the first (N-1) highest salaries and select the next one 14 | LIMIT M, 1 15 | ); 16 | END; 17 | -------------------------------------------------------------------------------- /3457-invalid-tweets-ii/invalid-tweets-ii.sql: -------------------------------------------------------------------------------- 1 | -- Main query to find invalid tweets based on the given criteria 2 | SELECT 3 | tweet_id 4 | FROM 5 | Tweets 6 | WHERE 7 | -- Condition to check if the tweet exceeds 140 characters in length 8 | LENGTH(content) > 140 9 | OR 10 | -- Condition to check if the tweet has more than 3 mentions 11 | (LENGTH(content) - LENGTH(REPLACE(content, '@', ''))) > 3 12 | OR 13 | -- Condition to check if the tweet has more than 3 hashtags 14 | (LENGTH(content) - LENGTH(REPLACE(content, '#', ''))) > 3 15 | ORDER BY 16 | tweet_id ASC; 17 | -------------------------------------------------------------------------------- /3685-count-subarrays-of-length-three-with-a-condition/count-subarrays-of-length-three-with-a-condition.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def countSubarrays(self, nums: List[int]) -> int: 5 | """ 6 | Counts the number of subarrays of length 3 where 7 | nums[i+1] is the half of sum of nums[i] and nums[i+2]. 8 | """ 9 | subarray_count = 0 10 | n = len(nums) 11 | 12 | for i in range(n - 2): 13 | if nums[i] + nums[i + 2] == nums[i + 1] / 2: 14 | subarray_count += 1 15 | 16 | return subarray_count 17 | -------------------------------------------------------------------------------- /2292-counting-words-with-a-given-prefix/counting-words-with-a-given-prefix.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def prefixCount(self, words: List[str], pref: str) -> int: 3 | """ 4 | Count the number of words that start with a given prefix. 5 | 6 | :param words: List[str] - List of words to search. 7 | :param pref: str - The prefix to check. 8 | :return: int - Count of words starting with the prefix. 9 | """ 10 | # Use a generator expression to check if each word starts with the prefix and sum the results 11 | return sum(word.startswith(pref) for word in words) 12 | -------------------------------------------------------------------------------- /2813-to-be-or-not-to-be/to-be-or-not-to-be.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {string} val 3 | * @return {Object} 4 | */ 5 | var expect = function(val) { 6 | return { 7 | toBe: val2 => { 8 | if (val === val2) 9 | return true 10 | else 11 | throw "Not Equal" 12 | }, 13 | notToBe: val2 => { 14 | if (val !== val2) 15 | return true 16 | else 17 | throw "Equal" 18 | } 19 | } 20 | }; 21 | 22 | /** 23 | * expect(5).toBe(5); // true 24 | * expect(5).notToBe(5); // throws "Equal" 25 | */ -------------------------------------------------------------------------------- /3582-find-indices-of-stable-mountains/find-indices-of-stable-mountains.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def stableMountains(self, height: List[int], threshold: int) -> List[int]: 5 | stable_mountain_indices: List[int] = [] 6 | 7 | # Iterate through the list of heights starting from the second element 8 | for i, h in enumerate(height[1:], start=1): 9 | # Check if the previous height exceeds the threshold 10 | if height[i - 1] > threshold: 11 | stable_mountain_indices.append(i) 12 | 13 | return stable_mountain_indices 14 | -------------------------------------------------------------------------------- /807-custom-sort-string/custom-sort-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def customSortString(self, order: str, s: str) -> str: 3 | order_index = defaultdict(int) 4 | 5 | # Create a dictionary to store the index of each character in the order string 6 | for i, char in enumerate(order): 7 | order_index[char] = i 8 | 9 | # Sort the characters in string s based on their indices in the order string 10 | sorted_s = sorted(s, key=lambda char: order_index[char]) 11 | 12 | # Join the sorted characters to form the final string 13 | return "".join(sorted_s) 14 | -------------------------------------------------------------------------------- /2050-count-good-numbers/count-good-numbers.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def countGoodNumbers(self, n: int) -> int: 3 | mod = 10**9 + 7 4 | # Calculate the number of even-indexed positions (0-indexed) 5 | even_positions = (n + 1) // 2 6 | # Calculate the number of odd-indexed positions (0-indexed) 7 | odd_positions = n // 2 8 | 9 | # Compute the result using modular exponentiation: 10 | # 5 choices for even indices and 4 choices for odd indices. 11 | result = (pow(5, even_positions, mod) * pow(4, odd_positions, mod)) % mod 12 | return result 13 | -------------------------------------------------------------------------------- /28-find-the-index-of-the-first-occurrence-in-a-string/find-the-index-of-the-first-occurrence-in-a-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def strStr(self, haystack: str, needle: str) -> int: 3 | if len(haystack) < len(needle): 4 | return -1 5 | for i in range(len(haystack) - len(needle) + 1): 6 | for j in range(len(needle)): 7 | if haystack[i + j] != needle[j]: 8 | break 9 | else: 10 | return i 11 | return -1 12 | 13 | ################################### 14 | 15 | return haystack.find(needle) 16 | -------------------------------------------------------------------------------- /100-same-tree/same-tree.py: -------------------------------------------------------------------------------- 1 | # Definition for a binary tree node. 2 | # class TreeNode: 3 | # def __init__(self, val=0, left=None, right=None): 4 | # self.val = val 5 | # self.left = left 6 | # self.right = right 7 | class Solution: 8 | def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: 9 | if not p and not q: 10 | return True 11 | if not p or not q: 12 | return False 13 | if p.val != q.val: 14 | return False 15 | return self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) 16 | 17 | -------------------------------------------------------------------------------- /1426-find-n-unique-integers-sum-up-to-zero/find-n-unique-integers-sum-up-to-zero.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def sumZero(self, n: int) -> List[int]: 5 | # Result container 6 | result = [] 7 | 8 | # Generate pairs that cancel each other 9 | for i in range(1, n // 2 + 1): 10 | result.append(i) # positive number 11 | result.append(-i) # matching negative number 12 | 13 | # If n is odd, add 0 to balance the sum 14 | if n % 2 == 1: 15 | result.append(0) 16 | 17 | return result 18 | -------------------------------------------------------------------------------- /1452-restaurant-growth/restaurant-growth.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | visited_on, 3 | amount, 4 | ROUND(amount / 7, 2) AS average_amount 5 | FROM ( 6 | SELECT 7 | DISTINCT visited_on, 8 | -- Rolling 7-day sum ending on each visited_on 9 | SUM(amount) OVER ( 10 | ORDER BY visited_on 11 | RANGE BETWEEN INTERVAL 6 DAY PRECEDING AND CURRENT ROW 12 | ) AS amount, 13 | 14 | -- First available visited_on date 15 | MIN(visited_on) OVER () AS first_date 16 | FROM Customer 17 | ) AS t 18 | WHERE visited_on >= DATE_ADD(first_date, INTERVAL 6 DAY); 19 | -------------------------------------------------------------------------------- /2370-users-with-two-purchases-within-seven-days/users-with-two-purchases-within-seven-days.sql: -------------------------------------------------------------------------------- 1 | with ordered_purchases as ( 2 | select user_id, purchase_date, row_number() over (partition by user_id order by purchase_date asc) as rn from purchases 3 | ), 4 | ordered_purchases_with_prev_purchase as ( 5 | select op1.user_id, op1.purchase_date as next_date, op2.purchase_date as prev_date from ordered_purchases as op1 join ordered_purchases as op2 on op1.user_id = op2.user_id and op1.rn = op2.rn+1 6 | ) 7 | 8 | select distinct user_id from ordered_purchases_with_prev_purchase where datediff(next_date, prev_date) <= 7 order by user_id; -------------------------------------------------------------------------------- /3156-rolling-average-steps/rolling-average-steps.sql: -------------------------------------------------------------------------------- 1 | WITH StepsWithLag AS ( 2 | SELECT 3 | user_id, 4 | steps_date, 5 | ROUND(AVG(steps_count) OVER (PARTITION BY user_id ORDER BY steps_date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 2) AS rolling_average, 6 | LAG(steps_date, 2) OVER (PARTITION BY user_id ORDER BY steps_date) AS lag_date 7 | FROM 8 | steps 9 | ) 10 | SELECT 11 | user_id, 12 | steps_date, 13 | rolling_average 14 | FROM 15 | StepsWithLag 16 | WHERE 17 | DATEDIFF(steps_date, lag_date) = 2 18 | ORDER BY 19 | user_id, 20 | steps_date; 21 | -------------------------------------------------------------------------------- /3617-find-the-original-typed-string-i/find-the-original-typed-string-i.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def possibleStringCount(self, word: str) -> int: 5 | total_count: int = 1 # Start with 1 for the first character 6 | run_length: int = 1 7 | 8 | for i in range(1, len(word)): 9 | if word[i] == word[i - 1]: 10 | run_length += 1 11 | else: 12 | total_count += run_length - 1 13 | run_length = 1 14 | 15 | total_count += run_length - 1 # Account for the last run 16 | 17 | return total_count 18 | -------------------------------------------------------------------------------- /578-get-highest-answer-rate-question/get-highest-answer-rate-question.sql: -------------------------------------------------------------------------------- 1 | -- CTE to calculate the answer rates for each question and rank them 2 | WITH answer_rates AS ( 3 | SELECT 4 | question_id, 5 | ROW_NUMBER() OVER (ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC, question_id ASC) AS rn 6 | FROM 7 | surveylog 8 | GROUP BY 9 | question_id 10 | ) 11 | 12 | -- Main query to find the question with the highest answer rate 13 | SELECT 14 | question_id AS survey_log 15 | FROM 16 | answer_rates 17 | WHERE 18 | rn = 1 19 | AND question_id IS NOT NULL; 20 | -------------------------------------------------------------------------------- /1510-find-lucky-integer-in-an-array/find-lucky-integer-in-an-array.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | from typing import List 3 | 4 | class Solution: 5 | def findLucky(self, arr: List[int]) -> int: 6 | """ 7 | Returns the largest lucky integer in the array. 8 | A lucky integer is one whose value is equal to its frequency in the array. 9 | If no such integer exists, returns -1. 10 | """ 11 | frequencies: Counter[int] = Counter(arr) 12 | lucky_numbers: List[int] = [num for num, count in frequencies.items() if num == count] 13 | return max(lucky_numbers, default=-1) 14 | -------------------------------------------------------------------------------- /1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: 3 | # Split the sentence into words 4 | words = sentence.split() 5 | 6 | # Iterate through the words and check if any starts with the search word 7 | for index, word in enumerate(words): 8 | if word.startswith(searchWord): 9 | return index + 1 # Return 1-based index if match is found 10 | 11 | return -1 # Return -1 if no prefix match is found 12 | -------------------------------------------------------------------------------- /1642-water-bottles/water-bottles.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def numWaterBottles(self, numBottles: int, numExchange: int) -> int: 3 | total_drunk = 0 4 | full_bottles = numBottles 5 | empty_bottles = 0 6 | 7 | while full_bottles > 0: 8 | # Drink all full bottles 9 | total_drunk += full_bottles 10 | # Calculate new full bottles by exchanging empty bottles 11 | new_bottles = (full_bottles + empty_bottles) 12 | full_bottles = new_bottles // numExchange 13 | empty_bottles = new_bottles % numExchange 14 | 15 | return total_drunk 16 | -------------------------------------------------------------------------------- /2057-count-salary-categories/count-salary-categories.sql: -------------------------------------------------------------------------------- 1 | -- Select the count of accounts in the "Low Salary" category 2 | SELECT "Low Salary" AS category, 3 | SUM(income < 20000) AS accounts_count 4 | FROM Accounts 5 | 6 | UNION 7 | 8 | -- Select the count of accounts in the "Average Salary" category 9 | SELECT "Average Salary" AS category, 10 | SUM(income BETWEEN 20000 AND 50000) AS accounts_count 11 | FROM Accounts 12 | 13 | UNION 14 | 15 | -- Select the count of accounts in the "High Salary" category 16 | SELECT "High Salary" AS category, 17 | SUM(income > 50000) AS accounts_count 18 | FROM Accounts; 19 | -------------------------------------------------------------------------------- /104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxDepth(self, root: Optional[TreeNode]) -> int: 3 | # If the tree is empty, return 0 4 | if not root: 5 | return 0 6 | 7 | # Recursively calculate the maximum depth of the left subtree 8 | left_d = self.maxDepth(root.left) 9 | 10 | # Recursively calculate the maximum depth of the right subtree 11 | right_d = self.maxDepth(root.right) 12 | 13 | # Return the maximum depth of the subtree rooted at the current node 14 | return max(left_d, right_d) + 1 15 | -------------------------------------------------------------------------------- /1468-check-if-n-and-its-double-exist/check-if-n-and-its-double-exist.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def checkIfExist(self, numbers: List[int]) -> bool: 5 | seen_numbers = set() # Set to store numbers we've encountered 6 | 7 | for number in numbers: 8 | # Check if the current number's double or half exists in the set 9 | if number * 2 in seen_numbers or number / 2 in seen_numbers: 10 | return True 11 | 12 | # Add the current number to the set 13 | seen_numbers.add(number) 14 | 15 | return False 16 | -------------------------------------------------------------------------------- /1615-range-sum-of-sorted-subarray-sums/range-sum-of-sorted-subarray-sums.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def rangeSum(self, nums: List[int], n: int, left: int, right: int) -> int: 3 | prefix = [0] 4 | running_sum = 0 5 | for num in nums: 6 | running_sum += num 7 | prefix.append(running_sum) 8 | 9 | sums = [] 10 | for i in range(len(prefix)-1): 11 | for j in range(i+1, len(prefix)): 12 | range_sum = prefix[j] - prefix[i] 13 | sums.append(range_sum) 14 | 15 | sums.sort() 16 | 17 | return sum(sums[left-1:right]) % (10**9 + 7) -------------------------------------------------------------------------------- /242-valid-anagram/valid-anagram.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution: 4 | def isAnagram(self, s: str, t: str) -> bool: 5 | """ 6 | Checks if two strings are anagrams. 7 | 8 | Args: 9 | - s: First string 10 | - t: Second string 11 | 12 | Returns: 13 | - True if s and t are anagrams, False otherwise 14 | """ 15 | # Construct dictionaries of character counts for both strings 16 | s_count = Counter(s) 17 | t_count = Counter(t) 18 | 19 | # Compare the dictionaries for equality 20 | return s_count == t_count 21 | -------------------------------------------------------------------------------- /3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i/minimum-operations-to-make-binary-array-elements-equal-to-one-i.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def minOperations(self, nums: List[int]) -> int: 3 | flip_count = 0 4 | 5 | for i in range(len(nums)): 6 | if nums[i] == 0: 7 | if i >= (len(nums) - 2): 8 | return -1 9 | else: 10 | nums[i] ^= 1 11 | nums[i + 1] ^= 1 12 | nums[i + 2] ^= 1 13 | flip_count += 1 14 | 15 | return flip_count 16 | 17 | -------------------------------------------------------------------------------- /871-keys-and-rooms/keys-and-rooms.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | from typing import List 3 | 4 | class Solution: 5 | def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: 6 | visited_rooms = set() 7 | visited_rooms.add(0) 8 | 9 | queue = deque() 10 | queue.append(0) 11 | 12 | while queue: 13 | current_room = queue.popleft() 14 | for key in rooms[current_room]: 15 | if key not in visited_rooms: 16 | visited_rooms.add(key) 17 | queue.append(key) 18 | 19 | return len(visited_rooms) == len(rooms) 20 | -------------------------------------------------------------------------------- /387-first-unique-character-in-a-string/first-unique-character-in-a-string.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution: 4 | def firstUniqChar(self, s: str) -> int: 5 | # Count occurrences of each character in the string 6 | char_counts = Counter(s) 7 | 8 | # Iterate through the string to find the first unique character 9 | for i, char in enumerate(s): 10 | if char_counts[char] == 1: 11 | # Return the index of the first unique character 12 | return i 13 | 14 | # If no unique character is found, return -1 15 | return -1 16 | -------------------------------------------------------------------------------- /1256-rank-transform-of-an-array/rank-transform-of-an-array.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def arrayRankTransform(self, arr: List[int]) -> List[int]: 5 | if not arr: 6 | return [] 7 | 8 | # Remove duplicates and sort the array to get unique elements in ascending order 9 | sorted_arr = sorted(set(arr)) 10 | 11 | # Create a dictionary that maps each number to its rank 12 | ranks = {num: rank for rank, num in enumerate(sorted_arr, start=1)} 13 | 14 | # Map each number in the original array to its corresponding rank 15 | return [ranks[num] for num in arr] 16 | -------------------------------------------------------------------------------- /2030-group-employees-of-the-same-salary/group-employees-of-the-same-salary.sql: -------------------------------------------------------------------------------- 1 | WITH unique_salary_ids AS ( 2 | SELECT 3 | e1.employee_id AS id 4 | FROM 5 | employees AS e1 6 | LEFT JOIN 7 | employees AS e2 ON e1.employee_id != e2.employee_id AND e1.salary = e2.salary 8 | WHERE 9 | e2.salary IS NULL 10 | ) 11 | 12 | SELECT 13 | employee_id, 14 | name, 15 | salary, 16 | DENSE_RANK() OVER (ORDER BY salary) AS team_id 17 | FROM 18 | employees 19 | WHERE 20 | employee_id NOT IN (SELECT id FROM unique_salary_ids) 21 | ORDER BY 22 | team_id, 23 | employee_id; 24 | -------------------------------------------------------------------------------- /2277-count-equal-and-divisible-pairs-in-an-array/count-equal-and-divisible-pairs-in-an-array.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def countPairs(self, nums: List[int], k: int) -> int: 5 | """ 6 | Counts the number of pairs (i, j) where: 7 | - nums[i] == nums[j] 8 | - i < j 9 | - (i * j) % k == 0 10 | """ 11 | pair_count = 0 12 | n = len(nums) 13 | 14 | for i in range(n - 1): 15 | for j in range(i + 1, n): 16 | if nums[i] == nums[j] and (i * j) % k == 0: 17 | pair_count += 1 18 | 19 | return pair_count 20 | -------------------------------------------------------------------------------- /55-jump-game/jump-game.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def canJump(self, nums: List[int]) -> bool: 5 | # Initialize the goal to the last index 6 | goal = len(nums) - 1 7 | 8 | # Traverse the list from the second to last element to the first element 9 | for i in range(len(nums) - 2, -1, -1): 10 | # Check if the current position can reach the goal 11 | if i + nums[i] >= goal: 12 | # Update the goal to the current position 13 | goal = i 14 | 15 | # Check if the goal has been updated to the first index 16 | return goal == 0 17 | -------------------------------------------------------------------------------- /1882-the-number-of-employees-which-report-to-each-employee/the-number-of-employees-which-report-to-each-employee.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e1.employee_id, 3 | e1.name, 4 | COUNT(e2.employee_id) AS reports_count, -- Count of employees reporting to e1 5 | ROUND(AVG(e2.age)) AS average_age -- Average age of those reporting to e1 6 | FROM Employees e1 7 | INNER JOIN Employees e2 8 | ON e1.employee_id = e2.reports_to -- Join employees with their subordinates 9 | GROUP BY e1.employee_id, e1.name -- Group by employee_id and name for accurate aggregation 10 | ORDER BY e1.employee_id; -- Sort the results by employee_id 11 | -------------------------------------------------------------------------------- /2097-strong-friendship/strong-friendship.sql: -------------------------------------------------------------------------------- 1 | WITH all_pairs AS ( 2 | SELECT user1_id, user2_id FROM Friendship 3 | UNION 4 | SELECT user2_id, user1_id FROM Friendship 5 | ), 6 | common_friends_count AS ( 7 | SELECT f1.user1_id, f1.user2_id, COUNT(f3.user2_id) AS common_friend 8 | FROM Friendship AS f1 9 | JOIN all_pairs AS f2 ON f1.user1_id = f2.user1_id AND f1.user2_id != f2.user2_id 10 | JOIN all_pairs AS f3 ON f1.user2_id = f3.user1_id AND f2.user2_id = f3.user2_id 11 | GROUP BY f1.user1_id, f1.user2_id 12 | ) 13 | SELECT user1_id, user2_id, common_friend 14 | FROM common_friends_count 15 | WHERE common_friend >= 3; 16 | -------------------------------------------------------------------------------- /3515-find-if-digit-game-can-be-won/find-if-digit-game-can-be-won.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def canAliceWin(self, nums: List[int]) -> bool: 3 | total_sum = sum(nums) # Calculate the total sum of all numbers 4 | 5 | # Calculate the sum of single-digit numbers 6 | single_digit_sum = sum(num for num in nums if num < 10) 7 | 8 | # Calculate the sum of double-digit numbers 9 | double_digit_sum = total_sum - single_digit_sum 10 | 11 | # Alice can win if the sum of single-digit numbers is not equal to the sum of double-digit numbers 12 | return single_digit_sum != double_digit_sum 13 | -------------------------------------------------------------------------------- /1993-sum-of-all-subset-xor-totals/sum-of-all-subset-xor-totals.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def subsetXORSum(self, nums: List[int]) -> int: 5 | n = len(nums) 6 | total_sum = 0 7 | 8 | # Iterate over all possible subsets 9 | for subset in range(1 << n): # 1 << n is 2^n, representing all subsets 10 | subset_xor = 0 11 | for i in range(n): 12 | # Check if the i-th element is in the current subset 13 | if subset & (1 << i): 14 | subset_xor ^= nums[i] 15 | total_sum += subset_xor 16 | 17 | return total_sum 18 | -------------------------------------------------------------------------------- /1160-letter-tile-possibilities/letter-tile-possibilities.py: -------------------------------------------------------------------------------- 1 | from itertools import permutations 2 | 3 | class Solution: 4 | def numTilePossibilities(self, tiles: str) -> int: 5 | """ 6 | Calculates the number of unique sequences that can be formed 7 | using the given tiles. 8 | """ 9 | 10 | total_sequences = 0 11 | 12 | # Generate all possible permutations for lengths from 1 to len(tiles) 13 | for length in range(1, len(tiles) + 1): 14 | unique_permutations = set(permutations(tiles, length)) 15 | total_sequences += len(unique_permutations) 16 | 17 | return total_sequences 18 | -------------------------------------------------------------------------------- /2128-reverse-prefix-of-word/reverse-prefix-of-word.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reversePrefix(self, word: str, ch: str) -> str: 3 | # Find the index of the target character in the word 4 | index_of_ch = word.find(ch) 5 | # If the character is not found, return the original word 6 | if index_of_ch == -1: 7 | return word 8 | else: 9 | # Reverse the prefix of the word up to the target character 10 | reversed_prefix = word[:index_of_ch+1][::-1] 11 | # Concatenate the reversed prefix with the remaining part of the word 12 | return reversed_prefix + word[index_of_ch+1:] 13 | -------------------------------------------------------------------------------- /498-diagonal-traverse/diagonal-traverse.py: -------------------------------------------------------------------------------- 1 | from itertools import chain 2 | 3 | class Solution: 4 | def findDiagonalOrder(self, mat: List[List[int]]) -> List[int]: 5 | m = len(mat) 6 | n = len(mat[0]) 7 | res = [[] for _ in range(m+n-1)] 8 | 9 | for i, row in enumerate(mat): 10 | for j, num in enumerate(row): 11 | res[i+j].append(num) 12 | 13 | reverse = True 14 | for i in range(len(res)): 15 | if reverse: 16 | res[i] = res[i][::-1] 17 | reverse = not reverse 18 | 19 | return list(chain.from_iterable(res)) 20 | -------------------------------------------------------------------------------- /985-bag-of-tokens/bag-of-tokens.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def bagOfTokensScore(self, tokens: List[int], power: int) -> int: 3 | tokens.sort() 4 | l, r = 0, len(tokens)-1 5 | current_power = power 6 | score = 0 7 | 8 | while l <= r: 9 | if current_power >= tokens[l]: 10 | score += 1 11 | current_power -= tokens[l] 12 | l += 1 13 | elif l < r and score > 0: 14 | score -= 1 15 | current_power += tokens[r] 16 | r -= 1 17 | else: 18 | break 19 | 20 | return score -------------------------------------------------------------------------------- /1333-sort-the-jumbled-numbers/sort-the-jumbled-numbers.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def sortJumbled(self, mapping: List[int], nums: List[int]) -> List[int]: 5 | def get_mapped_value(num: int) -> int: 6 | # Convert the number to its mapped value according to the given mapping 7 | mapped_value = "" 8 | for digit in str(num): 9 | mapped_value += str(mapping[int(digit)]) 10 | return int(mapped_value) 11 | 12 | # Sort the nums list based on their mapped values 13 | nums.sort(key=lambda num: get_mapped_value(num)) 14 | 15 | return nums 16 | -------------------------------------------------------------------------------- /2132-convert-1d-array-into-2d-array/convert-1d-array-into-2d-array.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | class Solution: 4 | def construct2DArray(self, original: List[int], m: int, n: int) -> List[List[int]]: 5 | # Check if the total number of elements matches the required 2D array dimensions 6 | if len(original) != m * n: 7 | return [] 8 | 9 | # Initialize the result 2D array 10 | result = [] 11 | 12 | # Construct the 2D array by slicing the original array into rows of length 'n' 13 | for i in range(0, len(original), n): 14 | result.append(original[i:i+n]) 15 | 16 | return result 17 | -------------------------------------------------------------------------------- /3567-convert-date-to-binary/convert-date-to-binary.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def convertDateToBinary(self, date: str) -> str: 3 | # Split the input date by "-" to separate year, month, and day 4 | date_parts: list[str] = date.split("-") 5 | binary_date_parts: list[str] = [] 6 | 7 | # Convert each part of the date to binary and remove the '0b' prefix 8 | for part in date_parts: 9 | binary_representation: str = bin(int(part))[2:] 10 | binary_date_parts.append(binary_representation) 11 | 12 | # Join the binary date parts with "-" to form the final string 13 | return "-".join(binary_date_parts) 14 | -------------------------------------------------------------------------------- /594-longest-harmonious-subsequence/longest-harmonious-subsequence.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from collections import Counter 3 | 4 | class Solution: 5 | def findLHS(self, nums: List[int]) -> int: 6 | """ 7 | Find the length of the longest harmonious subsequence. 8 | A harmonious array is where the difference between the maximum and minimum elements is exactly 1. 9 | """ 10 | freq: Counter[int] = Counter(nums) 11 | max_length: int = 0 12 | 13 | for num in freq: 14 | if num + 1 in freq: 15 | max_length = max(max_length, freq[num] + freq[num + 1]) 16 | 17 | return max_length 18 | -------------------------------------------------------------------------------- /2580-circular-sentence/circular-sentence.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def isCircularSentence(self, sentence: str) -> bool: 3 | # Split the sentence into words 4 | words = sentence.split() 5 | 6 | # Check if the last letter of the last word matches the first letter of the first word 7 | if words[-1][-1] != words[0][0]: 8 | return False 9 | 10 | # Check that each word begins with the last letter of the previous word 11 | for i in range(1, len(words)): 12 | if words[i][0] != words[i - 1][-1]: 13 | return False 14 | 15 | # If all checks pass, return True 16 | return True 17 | -------------------------------------------------------------------------------- /3283-find-third-transaction/find-third-transaction.sql: -------------------------------------------------------------------------------- 1 | WITH ranks_tx AS ( 2 | SELECT 3 | *, 4 | RANK() OVER (PARTITION BY user_id ORDER BY transaction_date ASC) AS ranks 5 | FROM 6 | Transactions 7 | ) 8 | SELECT 9 | r1.user_id, 10 | r1.spend AS third_transaction_spend, 11 | r1.transaction_date AS third_transaction_date 12 | FROM 13 | ranks_tx AS r1 14 | LEFT JOIN 15 | ranks_tx AS r2 ON r1.ranks = 3 AND r1.ranks - 1 = r2.ranks AND r1.user_id = r2.user_id 16 | LEFT JOIN 17 | ranks_tx AS r3 ON r2.ranks - 1 = r3.ranks AND r1.user_id = r3.user_id 18 | WHERE 19 | r1.spend > r2.spend 20 | AND r1.spend > r3.spend; 21 | -------------------------------------------------------------------------------- /191-number-of-1-bits/number-of-1-bits.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def hammingWeight(self, n: int) -> int: 3 | """ 4 | Count the number of '1' bits in the binary representation of the given integer. 5 | 6 | Args: 7 | - n: An integer for which the Hamming weight needs to be calculated. 8 | 9 | Returns: 10 | - int: The number of '1' bits in the binary representation of n. 11 | """ 12 | count = 0 13 | # Loop until n becomes 0 14 | while n > 0: 15 | # Clear the least significant '1' bit in n and increment the count 16 | n &= n - 1 17 | count += 1 18 | return count 19 | -------------------------------------------------------------------------------- /49-group-anagrams/group-anagrams.py: -------------------------------------------------------------------------------- 1 | import collections 2 | 3 | class Solution: 4 | def groupAnagrams(self, strs: List[str]) -> List[List[str]]: 5 | if not strs: 6 | return [[]] # Return empty list if input is empty 7 | grouped_anagrams = collections.defaultdict(list) 8 | for word in strs: 9 | if len(word) == 0: 10 | grouped_anagrams[""].append("") # Handle empty string case 11 | else: 12 | sorted_word = "".join(sorted(word)) 13 | grouped_anagrams[sorted_word].append(word) 14 | return list(grouped_anagrams.values()) # Convert to list for the expected output format 15 | -------------------------------------------------------------------------------- /599-minimum-index-sum-of-two-lists/minimum-index-sum-of-two-lists.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]: 3 | res = [] 4 | list1_map = {} 5 | for i, word in enumerate(list1): 6 | list1_map[word] = i 7 | min_sum = float("inf") 8 | for j, word in enumerate(list2): 9 | if word in list1_map: 10 | i = list1_map[word] 11 | if i + j < min_sum: 12 | res = [word] 13 | min_sum = i + j 14 | elif i + j == min_sum: 15 | res.append(word) 16 | return res 17 | -------------------------------------------------------------------------------- /11-container-with-most-water/container-with-most-water.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxArea(self, height: List[int]) -> int: 3 | left, right = 0, len(height) - 1 4 | max_area = 0 5 | 6 | while left < right: 7 | # Calculate the area formed by the two lines 8 | current_area = (right - left) * min(height[left], height[right]) 9 | max_area = max(max_area, current_area) 10 | 11 | # Move the pointer of the shorter line inward 12 | if height[left] < height[right]: 13 | left += 1 14 | else: 15 | right -= 1 16 | 17 | return max_area 18 | -------------------------------------------------------------------------------- /189-rotate-array/rotate-array.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def rotate(self, nums: List[int], k: int) -> None: 3 | """ 4 | Do not return anything, modify nums in-place instead. 5 | """ 6 | k = k % len(nums) # Calculate the actual rotation amount within the length of nums 7 | nums.reverse() # Reverse the entire list 8 | nums[:k] = reversed(nums[:k]) # Reverse the first k elements 9 | nums[k:] = reversed(nums[k:]) # Reverse the remaining elements 10 | 11 | """ 12 | # Alternative method using pop and insert 13 | for i in range(k): 14 | a = nums.pop() 15 | nums.insert(0, a) 16 | """ 17 | -------------------------------------------------------------------------------- /2194-the-category-of-each-member-in-the-store/the-category-of-each-member-in-the-store.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | m.member_id, 3 | m.name, 4 | CASE 5 | WHEN (100 * COUNT(p.visit_id) / COUNT(v.visit_id)) >= 80 THEN 'Diamond' 6 | WHEN (100 * COUNT(p.visit_id) / COUNT(v.visit_id)) BETWEEN 50 AND 79 THEN 'Gold' 7 | WHEN (100 * COUNT(p.visit_id) / COUNT(v.visit_id)) < 50 THEN 'Silver' 8 | WHEN COUNT(v.visit_id) = 0 THEN 'Bronze' 9 | END AS category 10 | FROM 11 | members AS m 12 | LEFT JOIN 13 | visits AS v USING (member_id) 14 | LEFT JOIN 15 | purchases AS p USING (visit_id) 16 | GROUP BY 17 | m.member_id 18 | ORDER BY 19 | m.member_id; 20 | -------------------------------------------------------------------------------- /2524-largest-positive-integer-that-exists-with-its-negative/largest-positive-integer-that-exists-with-its-negative.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def findMaxK(self, nums: List[int]) -> int: 3 | # Convert the list to a set for faster lookup 4 | set_nums = set(nums) 5 | # Initialize the result variable 6 | max_k = -1 7 | # Iterate through each number in the list 8 | for num in nums: 9 | # Check if the current number is positive and its negative counterpart exists in the set 10 | if num > 0 and -num in set_nums: 11 | # Update the maximum K value 12 | max_k = max(max_k, num) 13 | return max_k 14 | --------------------------------------------------------------------------------