LeetCode

LeetCode-Practices

Collection of LeetCode questions to ace the coding interview! - Created using LeetHub.

Two Pointers

| | | ——- | | 0853-most-profit-assigning-work | | 2572-append-characters-to-string-to-make-subsequence |

String

| | | ——- | | 2572-append-characters-to-string-to-make-subsequence |

Greedy

| | | ——- | | 0330-patching-array | | 0853-most-profit-assigning-work | | 2572-append-characters-to-string-to-make-subsequence |

Array

| | | ——- | | 0330-patching-array | | 0853-most-profit-assigning-work | | 1370-count-number-of-nice-subarrays |

Binary Search

| | | ——- | | 0853-most-profit-assigning-work |

Sorting

| | | ——- | | 0853-most-profit-assigning-work |

Hash Table

| | | ——- | | 1370-count-number-of-nice-subarrays |

Math

| | | ——- | | 1370-count-number-of-nice-subarrays |

Sliding Window

| | | ——- | | 1370-count-number-of-nice-subarrays |

LeetCode Topics

Linked List

| | | ——- | | 2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points | | 2299-merge-nodes-in-between-zeros |

Simulation

| | | ——- | | 2006-find-the-student-that-will-replace-the-chalk | | 2021-remove-all-occurrences-of-a-substring | | 2076-sum-of-digits-of-string-after-convert | | 2299-merge-nodes-in-between-zeros | | 2551-apply-operations-to-an-array | | 2645-pass-the-pillow | | 3332-minimum-operations-to-exceed-threshold-value-ii | | 3434-find-the-number-of-distinct-colors-among-the-balls | | 3447-clear-digits |

Math

| | | ——- | | 0264-ugly-number-ii | | 1477-product-of-the-last-k-numbers | | 1631-number-of-sub-arrays-with-odd-sum | | 1889-check-if-number-is-a-sum-of-powers-of-three | | 2448-count-number-of-bad-pairs | | 2610-closest-prime-numbers-in-range | | 2645-pass-the-pillow | | 2649-count-total-number-of-colored-cells | | 2802-find-the-punishment-number-of-an-integer | | 3227-find-missing-and-repeated-values |

Array

| | | ——- | | 0494-target-sum | | 0854-making-a-large-island | | 0905-length-of-longest-fibonacci-subsequence | | 0925-construct-binary-tree-from-preorder-and-postorder-traversal | | 1025-minimum-cost-for-tickets | | 1364-tuple-with-same-product | | 1396-count-servers-that-communicate | | 1477-product-of-the-last-k-numbers | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid | | 1524-string-matching-in-an-array | | 1556-make-two-arrays-equal-by-reversing-subarrays | | 1631-number-of-sub-arrays-with-odd-sum | | 1819-construct-the-lexicographically-largest-valid-sequence | | 1849-maximum-absolute-sum-of-any-subarray | | 1876-map-of-highest-peak | | 1895-minimum-number-of-operations-to-move-all-balls-to-each-box | | 1927-maximum-ascending-subarray-sum | | 2006-find-the-student-that-will-replace-the-chalk | | 2035-count-sub-islands | | 2107-find-unique-binary-string | | 2255-minimum-swaps-to-group-all-1s-together-ii | | 2292-counting-words-with-a-given-prefix | | 2448-count-number-of-bad-pairs | | 2473-max-sum-of-a-pair-with-equal-sum-of-digits | | 2533-bitwise-xor-of-all-pairings | | 2551-apply-operations-to-an-array | | 2665-minimum-time-to-repair-cars | | 2685-first-completely-painted-row-or-column | | 2690-house-robber-iv | | 2707-merge-two-2d-arrays-by-summing-values | | 2727-number-of-senior-citizens | | 2764-maximum-number-of-fish-in-a-grid | | 2766-find-the-prefix-common-array-of-two-arrays | | 2792-neighboring-bitwise-xor | | 3219-make-lexicographically-smallest-array-by-swapping-elements | | 3227-find-missing-and-repeated-values | | 3309-count-prefix-and-suffix-pairs-i | | 3332-minimum-operations-to-exceed-threshold-value-ii | | 3372-longest-strictly-increasing-or-strictly-decreasing-subarray | | 3429-special-array-i | | 3434-find-the-number-of-distinct-colors-among-the-balls | | 3483-alternating-groups-ii |

String

| | | ——- | | 1093-recover-a-tree-from-preorder-traversal | | 1160-letter-tile-possibilities | | 1502-construct-k-palindrome-strings | | 1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n | | 1524-string-matching-in-an-array | | 1895-minimum-number-of-operations-to-move-all-balls-to-each-box | | 1915-check-if-one-string-swap-can-make-strings-equal | | 2021-remove-all-occurrences-of-a-substring | | 2059-unique-length-3-palindromic-subsequences | | 2076-sum-of-digits-of-string-after-convert | | 2107-find-unique-binary-string | | 2221-check-if-a-parentheses-string-can-be-valid | | 2292-counting-words-with-a-given-prefix | | 2463-minimum-recolors-to-get-k-consecutive-black-blocks | | 2727-number-of-senior-citizens | | 3309-count-prefix-and-suffix-pairs-i | | 3447-clear-digits | | 3455-minimum-length-of-string-after-operations | | 3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii |

Sliding Window

| | | ——- | | 2255-minimum-swaps-to-group-all-1s-together-ii | | 2463-minimum-recolors-to-get-k-consecutive-black-blocks | | 3483-alternating-groups-ii | | 3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii |

Hash Table

| | | ——- | | 0264-ugly-number-ii | | 0905-length-of-longest-fibonacci-subsequence | | 0925-construct-binary-tree-from-preorder-and-postorder-traversal | | 0984-most-stones-removed-with-same-row-or-column | | 1160-letter-tile-possibilities | | 1364-tuple-with-same-product | | 1387-find-elements-in-a-contaminated-binary-tree | | 1502-construct-k-palindrome-strings | | 1556-make-two-arrays-equal-by-reversing-subarrays | | 1915-check-if-one-string-swap-can-make-strings-equal | | 2059-unique-length-3-palindromic-subsequences | | 2107-find-unique-binary-string | | 2434-design-a-number-container-system | | 2448-count-number-of-bad-pairs | | 2473-max-sum-of-a-pair-with-equal-sum-of-digits | | 2685-first-completely-painted-row-or-column | | 2707-merge-two-2d-arrays-by-summing-values | | 2766-find-the-prefix-common-array-of-two-arrays | | 3227-find-missing-and-repeated-values | | 3434-find-the-number-of-distinct-colors-among-the-balls | | 3455-minimum-length-of-string-after-operations | | 3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii |

Sorting

| | | ——- | | 1556-make-two-arrays-equal-by-reversing-subarrays | | 2473-max-sum-of-a-pair-with-equal-sum-of-digits | | 3219-make-lexicographically-smallest-array-by-swapping-elements |

Dynamic Programming

| | | ——- | | 0264-ugly-number-ii | | 0494-target-sum | | 0905-length-of-longest-fibonacci-subsequence | | 1025-minimum-cost-for-tickets | | 1631-number-of-sub-arrays-with-odd-sum | | 1849-maximum-absolute-sum-of-any-subarray |

Heap (Priority Queue)

| | | ——- | | 0264-ugly-number-ii | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid | | 2434-design-a-number-container-system | | 2473-max-sum-of-a-pair-with-equal-sum-of-digits | | 3332-minimum-operations-to-exceed-threshold-value-ii |

Bit Manipulation

| | | ——- | | 0476-number-complement | | 2059-unique-length-3-palindromic-subsequences | | 2509-minimize-xor | | 2533-bitwise-xor-of-all-pairings | | 2766-find-the-prefix-common-array-of-two-arrays | | 2792-neighboring-bitwise-xor |

| | | ——- | | 0684-redundant-connection | | 0820-find-eventual-safe-states | | 0854-making-a-large-island | | 0984-most-stones-removed-with-same-row-or-column | | 1093-recover-a-tree-from-preorder-traversal | | 1387-find-elements-in-a-contaminated-binary-tree | | 1396-count-servers-that-communicate | | 1558-course-schedule-iv | | 2035-count-sub-islands | | 2246-maximum-employees-to-be-invited-to-a-meeting | | 2764-maximum-number-of-fish-in-a-grid |

| | | ——- | | 0684-redundant-connection | | 0820-find-eventual-safe-states | | 0854-making-a-large-island | | 1387-find-elements-in-a-contaminated-binary-tree | | 1396-count-servers-that-communicate | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid | | 1558-course-schedule-iv | | 1876-map-of-highest-peak | | 2035-count-sub-islands | | 2583-divide-nodes-into-the-maximum-number-of-groups | | 2764-maximum-number-of-fish-in-a-grid |

Union Find

| | | ——- | | 0684-redundant-connection | | 0854-making-a-large-island | | 0984-most-stones-removed-with-same-row-or-column | | 1396-count-servers-that-communicate | | 2035-count-sub-islands | | 2583-divide-nodes-into-the-maximum-number-of-groups | | 2764-maximum-number-of-fish-in-a-grid | | 3219-make-lexicographically-smallest-array-by-swapping-elements |

Matrix

| | | ——- | | 0854-making-a-large-island | | 1396-count-servers-that-communicate | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid | | 1876-map-of-highest-peak | | 2035-count-sub-islands | | 2685-first-completely-painted-row-or-column | | 2764-maximum-number-of-fish-in-a-grid | | 3227-find-missing-and-repeated-values |

Graph

| | | ——- | | 0684-redundant-connection | | 0820-find-eventual-safe-states | | 0984-most-stones-removed-with-same-row-or-column | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid | | 1558-course-schedule-iv | | 2246-maximum-employees-to-be-invited-to-a-meeting | | 2583-divide-nodes-into-the-maximum-number-of-groups |

Binary Search

| | | ——- | | 2006-find-the-student-that-will-replace-the-chalk | | 2665-minimum-time-to-repair-cars | | 2690-house-robber-iv |

Prefix Sum

| | | ——- | | 1477-product-of-the-last-k-numbers | | 1631-number-of-sub-arrays-with-odd-sum | | 1895-minimum-number-of-operations-to-move-all-balls-to-each-box | | 2006-find-the-student-that-will-replace-the-chalk | | 2059-unique-length-3-palindromic-subsequences |

Backtracking

| | | ——- | | 0494-target-sum | | 1160-letter-tile-possibilities | | 1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n | | 1819-construct-the-lexicographically-largest-valid-sequence | | 2107-find-unique-binary-string | | 2802-find-the-punishment-number-of-an-integer |

String Matching

| | | ——- | | 1524-string-matching-in-an-array | | 2292-counting-words-with-a-given-prefix | | 3309-count-prefix-and-suffix-pairs-i |

Trie

| | | ——- | | 3309-count-prefix-and-suffix-pairs-i |

Rolling Hash

| | | ——- | | 3309-count-prefix-and-suffix-pairs-i |

Hash Function

| | | ——- | | 3309-count-prefix-and-suffix-pairs-i |

Greedy

| | | ——- | | 1502-construct-k-palindrome-strings | | 2221-check-if-a-parentheses-string-can-be-valid | | 2509-minimize-xor |

Counting

| | | ——- | | 1160-letter-tile-possibilities | | 1364-tuple-with-same-product | | 1396-count-servers-that-communicate | | 1502-construct-k-palindrome-strings | | 1915-check-if-one-string-swap-can-make-strings-equal | | 2448-count-number-of-bad-pairs | | 3455-minimum-length-of-string-after-operations |

Stack

| | | ——- | | 2021-remove-all-occurrences-of-a-substring | | 2221-check-if-a-parentheses-string-can-be-valid | | 3447-clear-digits |

Brainteaser

| | | ——- | | 2533-bitwise-xor-of-all-pairings |

Shortest Path

| | | ——- | | 1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid |

Topological Sort

| | | ——- | | 0820-find-eventual-safe-states | | 1558-course-schedule-iv | | 2246-maximum-employees-to-be-invited-to-a-meeting |

Design

| | | ——- | | 1387-find-elements-in-a-contaminated-binary-tree | | 1477-product-of-the-last-k-numbers | | 2434-design-a-number-container-system |

Ordered Set

| | | ——- | | 2434-design-a-number-container-system |

Data Stream

| | | ——- | | 1477-product-of-the-last-k-numbers |

Tree

| | | ——- | | 0925-construct-binary-tree-from-preorder-and-postorder-traversal | | 1093-recover-a-tree-from-preorder-traversal | | 1387-find-elements-in-a-contaminated-binary-tree |

Binary Tree

| | | ——- | | 0925-construct-binary-tree-from-preorder-and-postorder-traversal | | 1093-recover-a-tree-from-preorder-traversal | | 1387-find-elements-in-a-contaminated-binary-tree |

Divide and Conquer

| | | ——- | | 0925-construct-binary-tree-from-preorder-and-postorder-traversal |

Two Pointers

| | | ——- | | 2551-apply-operations-to-an-array | | 2707-merge-two-2d-arrays-by-summing-values |

Number Theory

| | | ——- | | 2610-closest-prime-numbers-in-range |