From d2888360e2b9fddc7546b4e95344a3d3fb6d4c2d Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 28 Sep 2026 11:20:41 -0400 Subject: [PATCH] =?UTF-8?q?docs(docs):=20add=20ProblemBadges=20component,?= =?UTF-8?q?=20layout=20slot,=20and=20enrich=20pages=20with=20topics/video?= =?UTF-8?q?=20frontmatter,=20plus=20guide=20placeholders=20and=20topic?= =?UTF-8?q?=E2=80=91landing=20map.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/docs/components.ts | 10 +- apps/docs/components/ProblemBadges.astro | 92 +++++++++++++++++++ ...3-find-minimum-in-rotated-sorted-array.mdx | 10 +- .../33-search-in-rotated-sorted-array.mdx | 10 +- .../35-search-insert-position.mdx | 10 +- .../binary-search/704-binary-search.mdx | 10 +- .../binary-search/74-search-a-2d-matrix.mdx | 11 +-- .../binary-search/875-koko-eating-bananas.mdx | 10 +- .../hash-table/1-two-sum.mdx | 10 +- .../1832-check-if-the-sentence-is-pangram.mdx | 5 +- .../hash-table/217-contains-duplicate.mdx | 11 +-- .../hash-table/242-valid-anagram.mdx | 11 +-- .../347-top-k-frequent-elements.mdx | 16 ++-- ...387-first-unique-character-in-a-string.mdx | 12 +-- .../451-sort-characters-by-frequency.mdx | 14 +-- .../hash-table/49-group-anagrams.mdx | 12 +-- .../739-daily-temperatures.mdx | 11 +-- .../monotonic-stack/853-car-fleet.mdx | 12 +-- .../238-product-of-array-except-self.mdx | 10 +- .../303-range-sum-query-immutable.mdx | 11 +-- .../prefix-sum/560-subarray-sum-equals-k.mdx | 11 +-- .../121-best-time-to-buy-and-sell-stock.mdx | 10 +- ...substring-without-repeating-characters.mdx | 11 +-- ...ongest-repeating-character-replacement.mdx | 11 +-- .../567-permutation-in-string.mdx | 12 +-- .../150-evaluate-reverse-polish-notation.mdx | 11 +-- .../stack/155-min-stack.mdx | 10 +- .../stack/20-valid-parentheses.mdx | 11 +-- .../11-container-with-most-water.mdx | 11 +-- .../two-pointers/125-valid-palindrome.mdx | 10 +- .../two-pointers/15-3sum.mdx | 11 +-- .../167-two-sum-ii-input-array-is-sorted.mdx | 11 +-- .../two-pointers/344-reverse-string.mdx | 10 +- .../two-pointers/392-is-subsequence.mdx | 11 +-- .../977-squares-of-a-sorted-array.mdx | 11 +-- .../hybrid-structures/146-lru-cache.mdx | 12 +-- .../hybrid-structures/2-add-two-numbers.mdx | 11 +-- .../linked-list/141-linked-list-cycle.mdx | 12 +-- .../linked-list/206-reverse-linked-list.mdx | 10 +- .../linked-list/21-merge-two-sorted-lists.mdx | 10 +- .../matrix-index-math/48-rotate-image.mdx | 11 +-- .../matrix-index-math/54-spiral-matrix.mdx | 11 +-- .../73-set-matrix-zeroes.mdx | 11 +-- .../230-kth-smallest-element-in-a-bst.mdx | 12 +-- ...ommon-ancestor-of-a-binary-search-tree.mdx | 14 +-- .../98-validate-binary-search-tree.mdx | 12 +-- .../215-kth-largest-element-in-an-array.mdx | 13 +-- .../23-merge-k-sorted-lists.mdx | 13 +-- .../973-k-closest-points-to-origin.mdx | 16 ++-- .../102-binary-tree-level-order-traversal.mdx | 11 +-- .../1448-count-good-nodes-in-binary-tree.mdx | 12 +-- .../199-binary-tree-right-side-view.mdx | 12 +-- .../104-maximum-depth-of-binary-tree.mdx | 12 +-- .../tree-dfs/226-invert-binary-tree.mdx | 12 +-- ...owest-common-ancestor-of-a-binary-tree.mdx | 8 +- .../trie/208-implement-trie-prefix-tree.mdx | 12 +-- ...gn-add-and-search-words-data-structure.mdx | 12 +-- .../graph-bfs/127-word-ladder.mdx | 7 +- .../graph-bfs/994-rotting-oranges.mdx | 6 +- .../graph-dfs/133-clone-graph.mdx | 7 +- .../graph-dfs/200-number-of-islands.mdx | 8 +- .../417-pacific-atlantic-water-flow.mdx | 7 +- .../topological-sort/207-course-schedule.mdx | 8 +- .../210-course-schedule-ii.mdx | 7 +- ...cted-components-in-an-undirected-graph.mdx | 7 +- .../union-find/684-redundant-connection.mdx | 7 +- .../198-house-robber.mdx | 5 +- .../322-coin-change.mdx | 8 +- .../70-climbing-stairs.mdx | 6 +- .../backtracking/39-combination-sum.mdx | 5 +- .../backtracking/46-permutations.mdx | 5 +- .../backtracking/78-subsets.mdx | 6 +- apps/docs/content/guides/array.mdx | 8 ++ .../content/guides/bidirectional-search.mdx | 8 ++ apps/docs/content/guides/binary-lifting.mdx | 8 ++ apps/docs/content/guides/binary-tree.mdx | 8 ++ apps/docs/content/guides/bit-manipulation.mdx | 8 ++ .../docs/content/guides/bracket-sequences.mdx | 8 ++ apps/docs/content/guides/bucket-sort.mdx | 8 ++ .../docs/content/guides/complete-knapsack.mdx | 8 ++ apps/docs/content/guides/counting.mdx | 8 ++ apps/docs/content/guides/design.mdx | 8 ++ .../content/guides/directed-acyclic-graph.mdx | 8 ++ .../content/guides/divide-and-conquer.mdx | 8 ++ .../content/guides/doubly-linked-list.mdx | 8 ++ .../guides/floyds-cycle-finding-algorithm.mdx | 8 ++ apps/docs/content/guides/geometry.mdx | 8 ++ apps/docs/content/guides/graph.mdx | 8 ++ apps/docs/content/guides/k-d-tree.mdx | 8 ++ apps/docs/content/guides/knapsack-problem.mdx | 8 ++ .../content/guides/lowest-common-ancestor.mdx | 8 ++ apps/docs/content/guides/math.mdx | 8 ++ apps/docs/content/guides/memoization.mdx | 8 ++ apps/docs/content/guides/merge-sort.mdx | 8 ++ apps/docs/content/guides/meta.ts | 3 + apps/docs/content/guides/queue.mdx | 8 ++ apps/docs/content/guides/quickselect.mdx | 8 ++ apps/docs/content/guides/recursion.mdx | 8 ++ apps/docs/content/guides/simulation.mdx | 8 ++ apps/docs/content/guides/sorting.mdx | 8 ++ apps/docs/content/guides/string.mdx | 8 ++ apps/docs/content/guides/tournament-sort.mdx | 8 ++ apps/docs/content/guides/tree.mdx | 8 ++ apps/docs/topic-landings.ts | 35 +++++++ 104 files changed, 741 insertions(+), 355 deletions(-) create mode 100644 apps/docs/components/ProblemBadges.astro create mode 100644 apps/docs/content/guides/array.mdx create mode 100644 apps/docs/content/guides/bidirectional-search.mdx create mode 100644 apps/docs/content/guides/binary-lifting.mdx create mode 100644 apps/docs/content/guides/binary-tree.mdx create mode 100644 apps/docs/content/guides/bit-manipulation.mdx create mode 100644 apps/docs/content/guides/bracket-sequences.mdx create mode 100644 apps/docs/content/guides/bucket-sort.mdx create mode 100644 apps/docs/content/guides/complete-knapsack.mdx create mode 100644 apps/docs/content/guides/counting.mdx create mode 100644 apps/docs/content/guides/design.mdx create mode 100644 apps/docs/content/guides/directed-acyclic-graph.mdx create mode 100644 apps/docs/content/guides/divide-and-conquer.mdx create mode 100644 apps/docs/content/guides/doubly-linked-list.mdx create mode 100644 apps/docs/content/guides/floyds-cycle-finding-algorithm.mdx create mode 100644 apps/docs/content/guides/geometry.mdx create mode 100644 apps/docs/content/guides/graph.mdx create mode 100644 apps/docs/content/guides/k-d-tree.mdx create mode 100644 apps/docs/content/guides/knapsack-problem.mdx create mode 100644 apps/docs/content/guides/lowest-common-ancestor.mdx create mode 100644 apps/docs/content/guides/math.mdx create mode 100644 apps/docs/content/guides/memoization.mdx create mode 100644 apps/docs/content/guides/merge-sort.mdx create mode 100644 apps/docs/content/guides/meta.ts create mode 100644 apps/docs/content/guides/queue.mdx create mode 100644 apps/docs/content/guides/quickselect.mdx create mode 100644 apps/docs/content/guides/recursion.mdx create mode 100644 apps/docs/content/guides/simulation.mdx create mode 100644 apps/docs/content/guides/sorting.mdx create mode 100644 apps/docs/content/guides/string.mdx create mode 100644 apps/docs/content/guides/tournament-sort.mdx create mode 100644 apps/docs/content/guides/tree.mdx create mode 100644 apps/docs/topic-landings.ts diff --git a/apps/docs/components.ts b/apps/docs/components.ts index 4c6241c..d0cfbb0 100644 --- a/apps/docs/components.ts +++ b/apps/docs/components.ts @@ -1,7 +1,7 @@ /** - * Project MDX components, available on every page with no import. Static - * `.astro` files ship no framework JS (a custom element carries any - * behaviour); interactive React lives in `islands/` instead. + * Project MDX components, available on every page with no import, and layout + * slot overrides. Static `.astro` files ship no framework JS (a custom element + * carries any behaviour); interactive React lives in `islands/` instead. */ import { defineComponents } from "blume"; @@ -10,4 +10,8 @@ export default defineComponents({ Carousel: "./components/Carousel.astro", CarouselImage: "./components/CarouselImage.astro", }, + layout: { + // Problem pages' topic + explanation badges, from `topics:` / `video:` frontmatter. + PageHeader: "./components/ProblemBadges.astro", + }, }); diff --git a/apps/docs/components/ProblemBadges.astro b/apps/docs/components/ProblemBadges.astro new file mode 100644 index 0000000..4d7008a --- /dev/null +++ b/apps/docs/components/ProblemBadges.astro @@ -0,0 +1,92 @@ +--- +/** + * The `PageHeader` slot: the badge row above a page's title. Blume hands the + * slot only the route, so the page's frontmatter is looked up through the + * route manifest — the same `getEntry` call Blume's own page template makes. + * Pages with none of the keys below (landing pages, the changelog) render + * nothing. + * + * - `topics:` (problem pages, written by `apps/cli/sync.ts`) is LeetCode's own + * topic tags. A tag the campaign teaches (`topic-landings.ts`) links to that + * topic's landing page and reads accent; any other tag links to its guide + * page, `/guides/` (sync creates one per such tag), and reads neutral. + * - `video:` (problem pages, written by `apps/cli/videos.ts`) is the NeetCode + * walkthrough's YouTube id, the red "Explanation" badge at the end of the row. + * - `list:` (guide pages, written by sync on create) is the tag's LeetCode + * problem list, an orange "LeetCode list" badge. + * + * A tag naming two campaign topics (`Depth-First Search` is both Tree DFS and + * Graph DFS) links to the page's own topic — its route's first segment — when + * that is one of them; otherwise DFS/BFS prefer the tree topic for a problem + * LeetCode also tags `Tree` and the graph topic for the rest. A route the site + * does not serve (a landing or guide page removed) falls back to LeetCode's + * problem list for the tag, so a badge never links to a 404. + */ +import { getEntry } from "astro:content"; +import data from "blume:data"; +import Badge from "blume/components/content/Badge.astro"; +import { withBase } from "blume/components/islands/base-path.ts"; +import { TOPIC_LANDINGS } from "../topic-landings.ts"; + +interface Props { + route: string; +} + +interface TopicTag { + name: string; + slug: string; +} + +const { route } = Astro.props; +const at = data.routes.find((r: { path: string }) => r.path === route); +const entry = at ? await getEntry(at.collection, at.entryId) : undefined; +const tags: TopicTag[] = entry?.data.topics ?? []; +const video: string | undefined = entry?.data.video; +const list: string | undefined = entry?.data.list; + +const served = new Set(data.routes.map((r: { path: string }) => r.path)); +const own = `/${route.split("/")[1]}`; +const prefer = tags.some((t) => t.slug === "tree") ? "/tree-" : "/graph-"; + +const badges = tags.map((tag) => { + const landings = (TOPIC_LANDINGS[tag.slug] ?? []).filter((path) => served.has(path)); + const landing = landings.includes(own) ? own : (landings.find((p) => p.startsWith(prefer)) ?? landings[0]); + if (landing) return { name: tag.name, href: withBase(landing), accent: true, external: false }; + const guide = `/guides/${tag.slug}`; + if (served.has(guide)) return { name: tag.name, href: withBase(guide), accent: false, external: false }; + return { name: tag.name, href: `https://leetcode.com/problem-list/${tag.slug}/`, accent: false, external: true }; +}); + +const linkClass = "no-underline transition-opacity hover:opacity-80"; +--- + +{ + (badges.length > 0 || video || list) && ( +
+ {badges.map((b) => ( + + {b.name} + + ))} + {video && ( + + + Explanation + + + )} + {list && ( + + + LeetCode list + + + )} +
+ ) +} diff --git a/apps/docs/content/(01-linear-structures)/binary-search/153-find-minimum-in-rotated-sorted-array.mdx b/apps/docs/content/(01-linear-structures)/binary-search/153-find-minimum-in-rotated-sorted-array.mdx index a36b83b..5e1a2f0 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/153-find-minimum-in-rotated-sorted-array.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/153-find-minimum-in-rotated-sorted-array.mdx @@ -2,13 +2,15 @@ title: '153. Find Minimum in Rotated Sorted Array' description: 'Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:' icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } +video: "nIVW4P8b1VA" sidebar: label: 'Find Minimum in Rotated Sorted Array' badge: 'Medium' --- -Array - ::::warning Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]]. :::: @@ -69,7 +71,3 @@ class Solution: return nums[lowest_index] ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/binary-search/33-search-in-rotated-sorted-array.mdx b/apps/docs/content/(01-linear-structures)/binary-search/33-search-in-rotated-sorted-array.mdx index 1080e03..bcbdd4d 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/33-search-in-rotated-sorted-array.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/33-search-in-rotated-sorted-array.mdx @@ -2,13 +2,15 @@ title: '33. Search in Rotated Sorted Array' description: There is an integer array nums sorted in ascending order (with distinct values) icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } +video: "U8XENwh8Oy8" sidebar: label: 'Search in Rotated Sorted Array' badge: 'Medium' --- -Array - ::::warning You must write an algorithm with O(log n) runtime complexity. :::: @@ -93,7 +95,3 @@ var search = function(nums, target) { return -1; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/binary-search/35-search-insert-position.mdx b/apps/docs/content/(01-linear-structures)/binary-search/35-search-insert-position.mdx index 16a287d..06fde0d 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/35-search-insert-position.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/35-search-insert-position.mdx @@ -2,13 +2,15 @@ title: '35. Search Insert Position' description: Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } +video: "K-RYzDZkzCI" sidebar: label: 'Search Insert Position' badge: 'Easy' --- -Array - ::::warning You must write an algorithm with O(log n) runtime complexity. :::: @@ -66,7 +68,3 @@ class Solution: return (l + r) // 2 + 1 ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/binary-search/704-binary-search.mdx b/apps/docs/content/(01-linear-structures)/binary-search/704-binary-search.mdx index 45fba2b..4aea8ac 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/704-binary-search.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/704-binary-search.mdx @@ -2,13 +2,15 @@ title: '704. Binary Search' description: Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1 icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } +video: "s4DPM8ct1pI" sidebar: label: 'Binary Search' badge: 'Easy' --- -Array - ::::warning You must write an algorithm with O(log n) runtime complexity. :::: @@ -71,7 +73,3 @@ var search = function(nums, target) { return -1; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/binary-search/74-search-a-2d-matrix.mdx b/apps/docs/content/(01-linear-structures)/binary-search/74-search-a-2d-matrix.mdx index e39167b..9a8de6e 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/74-search-a-2d-matrix.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/74-search-a-2d-matrix.mdx @@ -2,13 +2,16 @@ title: '74. Search a 2D Matrix' description: 'You are given an m x n integer matrix matrix with the following two properties:' icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } + - { name: "Matrix", slug: "matrix" } +video: "Ber2pi2C0j0" sidebar: label: 'Search a 2D Matrix' badge: 'Medium' --- -Array - ::::warning You must write a solution in O(log(m * n)) time complexity. :::: @@ -86,7 +89,3 @@ class Solution: return True return False ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/binary-search/875-koko-eating-bananas.mdx b/apps/docs/content/(01-linear-structures)/binary-search/875-koko-eating-bananas.mdx index d5f6a25..6b7cac8 100644 --- a/apps/docs/content/(01-linear-structures)/binary-search/875-koko-eating-bananas.mdx +++ b/apps/docs/content/(01-linear-structures)/binary-search/875-koko-eating-bananas.mdx @@ -2,13 +2,15 @@ title: '875. Koko Eating Bananas' description: Koko loves to eat bananas. There are n piles of bananas, the i^th pile has piles[i] bananas. The guards have gone and will come back in h hours icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Binary Search", slug: "binary-search" } +video: "U2SozAs9RzA" sidebar: label: 'Koko Eating Bananas' badge: 'Medium' --- -Array - ### Example 1: - Input: `piles = [3,6,7,11], h = 8` - Output: `4` @@ -77,7 +79,3 @@ var minEatingSpeed = function(piles, h) { return l; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/1-two-sum.mdx b/apps/docs/content/(01-linear-structures)/hash-table/1-two-sum.mdx index b9f34d5..82df13d 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/1-two-sum.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/1-two-sum.mdx @@ -2,13 +2,15 @@ title: '1. Two Sum' description: You are given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } +video: "KLlXCFG5TnA" sidebar: label: 'Two Sum' badge: 'Easy' --- -Array - ::::warning Can you come up with an algorithm that is less than O(n^2) time complexity? :::: @@ -60,7 +62,3 @@ class Solution: seen[num] = i return [] ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/1832-check-if-the-sentence-is-pangram.mdx b/apps/docs/content/(01-linear-structures)/hash-table/1832-check-if-the-sentence-is-pangram.mdx index 1a64fe9..569eee4 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/1832-check-if-the-sentence-is-pangram.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/1832-check-if-the-sentence-is-pangram.mdx @@ -2,13 +2,14 @@ title: '1832. Check if the Sentence Is Pangram' description: A pangram is a sentence where every letter of the English alphabet appears at least once icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } sidebar: label: 'Check if the Sentence Is Pangram' badge: 'Easy' --- -Hash Table - ### Example 1: - Input: `sentence = "thequickbrownfoxjumpsoverthelazydog"` - Output: `true` diff --git a/apps/docs/content/(01-linear-structures)/hash-table/217-contains-duplicate.mdx b/apps/docs/content/(01-linear-structures)/hash-table/217-contains-duplicate.mdx index 0d50140..e8ef07f 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/217-contains-duplicate.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/217-contains-duplicate.mdx @@ -2,13 +2,16 @@ title: '217. Contains Duplicate' description: Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } + - { name: "Sorting", slug: "sorting" } +video: "3OamzN90kPg" sidebar: label: 'Contains Duplicate' badge: 'Easy' --- -Array - ### Example 1: - Input: `nums = [1,2,3,1]` - Output: `true` @@ -48,7 +51,3 @@ class Solution: def containsDuplicate(self, nums: List[int]) -> bool: return len(set(nums)) != len(nums) ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/242-valid-anagram.mdx b/apps/docs/content/(01-linear-structures)/hash-table/242-valid-anagram.mdx index 09f276d..fc850c1 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/242-valid-anagram.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/242-valid-anagram.mdx @@ -2,13 +2,16 @@ title: '242. Valid Anagram' description: Given two strings s and t, return true if t is an anagram of s, and false otherwise icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Sorting", slug: "sorting" } +video: "9UtInBqnCgA" sidebar: label: 'Valid Anagram' badge: 'Easy' --- -Hash Table - ::::warning What if the inputs contain Unicode characters? How would you adapt your solution to such a case? :::: @@ -60,7 +63,3 @@ var isAnagram = function(s, t) { return true; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/347-top-k-frequent-elements.mdx b/apps/docs/content/(01-linear-structures)/hash-table/347-top-k-frequent-elements.mdx index 1607c16..797cfca 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/347-top-k-frequent-elements.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/347-top-k-frequent-elements.mdx @@ -2,13 +2,21 @@ title: '347. Top K Frequent Elements' description: Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } + - { name: "Divide and Conquer", slug: "divide-and-conquer" } + - { name: "Sorting", slug: "sorting" } + - { name: "Heap (Priority Queue)", slug: "heap-priority-queue" } + - { name: "Bucket Sort", slug: "bucket-sort" } + - { name: "Counting", slug: "counting" } + - { name: "Quickselect", slug: "quickselect" } +video: "YPTqKIgVk-k" sidebar: label: 'Top K Frequent Elements' badge: 'Medium' --- -Array - ::::warning Your algorithm's time complexity must be better than O(n log n), where n is the array's size. :::: @@ -60,7 +68,3 @@ var topKFrequent = function (nums, k) { .slice(0, k); }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/387-first-unique-character-in-a-string.mdx b/apps/docs/content/(01-linear-structures)/hash-table/387-first-unique-character-in-a-string.mdx index db51319..4fc7f6d 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/387-first-unique-character-in-a-string.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/387-first-unique-character-in-a-string.mdx @@ -2,13 +2,17 @@ title: '387. First Unique Character in a String' description: Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1 icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Queue", slug: "queue" } + - { name: "Counting", slug: "counting" } +video: "rBENYgWy3xU" sidebar: label: 'First Unique Character in a String' badge: 'Easy' --- -Hash Table - ### Example 1: - Input: `s = "leetcode"` - Output: `0` @@ -58,7 +62,3 @@ var firstUniqChar = function (s) { return -1; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/451-sort-characters-by-frequency.mdx b/apps/docs/content/(01-linear-structures)/hash-table/451-sort-characters-by-frequency.mdx index 53310ea..b741a32 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/451-sort-characters-by-frequency.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/451-sort-characters-by-frequency.mdx @@ -2,13 +2,19 @@ title: '451. Sort Characters By Frequency' description: Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Sorting", slug: "sorting" } + - { name: "Heap (Priority Queue)", slug: "heap-priority-queue" } + - { name: "Bucket Sort", slug: "bucket-sort" } + - { name: "Counting", slug: "counting" } +video: "OXdXc9HTrIg" sidebar: label: 'Sort Characters By Frequency' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `s = "tree"` - Output: `"eert"` @@ -60,7 +66,3 @@ var frequencySort = function (s) { .join(""); }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/hash-table/49-group-anagrams.mdx b/apps/docs/content/(01-linear-structures)/hash-table/49-group-anagrams.mdx index 378c7a9..fb2b250 100644 --- a/apps/docs/content/(01-linear-structures)/hash-table/49-group-anagrams.mdx +++ b/apps/docs/content/(01-linear-structures)/hash-table/49-group-anagrams.mdx @@ -2,13 +2,17 @@ title: '49. Group Anagrams' description: Given an array of strings strs, group the anagrams together. You can return the answer in any order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Sorting", slug: "sorting" } +video: "vzdNOK2oB2E" sidebar: label: 'Group Anagrams' badge: 'Medium' --- -Array - ### Example 1: - Input: `strs = ["eat","tea","tan","ate","nat","bat"]` - Output: `[["bat"],["nat","tan"],["ate","eat","tea"]]` @@ -65,7 +69,3 @@ var groupAnagrams = function(strs) { return Object.values(anagrams); }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/monotonic-stack/739-daily-temperatures.mdx b/apps/docs/content/(01-linear-structures)/monotonic-stack/739-daily-temperatures.mdx index 7b7dea6..4ab179e 100644 --- a/apps/docs/content/(01-linear-structures)/monotonic-stack/739-daily-temperatures.mdx +++ b/apps/docs/content/(01-linear-structures)/monotonic-stack/739-daily-temperatures.mdx @@ -2,13 +2,16 @@ title: '739. Daily Temperatures' description: Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the i^th day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Stack", slug: "stack" } + - { name: "Monotonic Stack", slug: "monotonic-stack" } +video: "cTBiBSnjO3c" sidebar: label: 'Daily Temperatures' badge: 'Medium' --- -Array - ### Example 1: - Input: `temperatures = [73,74,75,71,69,72,76,73]` - Output: `[1,1,4,2,1,1,0,0]` @@ -54,7 +57,3 @@ class Solution: stack.append(i) return ans ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/monotonic-stack/853-car-fleet.mdx b/apps/docs/content/(01-linear-structures)/monotonic-stack/853-car-fleet.mdx index 4ba58eb..cede4bf 100644 --- a/apps/docs/content/(01-linear-structures)/monotonic-stack/853-car-fleet.mdx +++ b/apps/docs/content/(01-linear-structures)/monotonic-stack/853-car-fleet.mdx @@ -2,13 +2,17 @@ title: '853. Car Fleet' description: There are n cars at given miles away from the starting mile 0, traveling to reach the mile target icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Stack", slug: "stack" } + - { name: "Sorting", slug: "sorting" } + - { name: "Monotonic Stack", slug: "monotonic-stack" } +video: "Pr6T-3yB9RM" sidebar: label: 'Car Fleet' badge: 'Medium' --- -Array - ### Example 1: - Input: `target = 12, position = [10,8,0,5,3], speed = [2,4,1,1,3]` - Output: `3` @@ -62,7 +66,3 @@ class Solution: return len(stack) ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/prefix-sum/238-product-of-array-except-self.mdx b/apps/docs/content/(01-linear-structures)/prefix-sum/238-product-of-array-except-self.mdx index 49992ad..2057f2b 100644 --- a/apps/docs/content/(01-linear-structures)/prefix-sum/238-product-of-array-except-self.mdx +++ b/apps/docs/content/(01-linear-structures)/prefix-sum/238-product-of-array-except-self.mdx @@ -2,13 +2,15 @@ title: '238. Product of Array Except Self' description: Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i] icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Prefix Sum", slug: "prefix-sum" } +video: "bNvIQI2wAjk" sidebar: label: 'Product of Array Except Self' badge: 'Medium' --- -Array - ::::warning You must write an algorithm that runs in O(n) time and without using the division operation. Can you solve the problem in O(1) extra space complexity? (The output array does not count as extra space for space complexity analysis.) @@ -63,7 +65,3 @@ var productExceptSelf = function(nums) { return answer; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/prefix-sum/303-range-sum-query-immutable.mdx b/apps/docs/content/(01-linear-structures)/prefix-sum/303-range-sum-query-immutable.mdx index 7ed5964..27e5de6 100644 --- a/apps/docs/content/(01-linear-structures)/prefix-sum/303-range-sum-query-immutable.mdx +++ b/apps/docs/content/(01-linear-structures)/prefix-sum/303-range-sum-query-immutable.mdx @@ -2,13 +2,16 @@ title: '303. Range Sum Query - Immutable' description: Given an integer array nums, handle multiple queries of the following type icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Design", slug: "design" } + - { name: "Prefix Sum", slug: "prefix-sum" } +video: "2pndAmo_sMA" sidebar: label: 'Range Sum Query - Immutable' badge: 'Easy' --- -Array - ### Example 1: - Input: `["NumArray", "sumRange", "sumRange", "sumRange"]` `[[[-2, 0, 3, -5, 2, -1]], [0, 2], [2, 5], [0, 5]]` - Output: `[null, 1, -1, -3]` @@ -66,7 +69,3 @@ class NumArray { * var param_1 = obj.sumRange(left,right) */ ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/prefix-sum/560-subarray-sum-equals-k.mdx b/apps/docs/content/(01-linear-structures)/prefix-sum/560-subarray-sum-equals-k.mdx index 0ac11e3..28ffbad 100644 --- a/apps/docs/content/(01-linear-structures)/prefix-sum/560-subarray-sum-equals-k.mdx +++ b/apps/docs/content/(01-linear-structures)/prefix-sum/560-subarray-sum-equals-k.mdx @@ -2,13 +2,16 @@ title: '560. Subarray Sum Equals K' description: Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } + - { name: "Prefix Sum", slug: "prefix-sum" } +video: "fFVZt-6sgyo" sidebar: label: 'Subarray Sum Equals K' badge: 'Medium' --- -Array - ### Example 1: - Input: `nums = [1,1,1], k = 2` - Output: `2` @@ -65,7 +68,3 @@ var subarraySum = function(nums, k) { return count }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/sliding-window/121-best-time-to-buy-and-sell-stock.mdx b/apps/docs/content/(01-linear-structures)/sliding-window/121-best-time-to-buy-and-sell-stock.mdx index ba13348..f16a23e 100644 --- a/apps/docs/content/(01-linear-structures)/sliding-window/121-best-time-to-buy-and-sell-stock.mdx +++ b/apps/docs/content/(01-linear-structures)/sliding-window/121-best-time-to-buy-and-sell-stock.mdx @@ -2,13 +2,15 @@ title: '121. Best Time to Buy and Sell Stock' description: You are given an array prices where prices[i] is the price of a given stock on the i^th day icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Dynamic Programming", slug: "dynamic-programming" } +video: "1pkOgXD63yU" sidebar: label: 'Best Time to Buy and Sell Stock' badge: 'Easy' --- -Array - ### Example 1: - Input: `prices = [7,1,5,3,6,4]` - Output: `5` @@ -55,7 +57,3 @@ class Solution: ans = max(ans, curr) return ans ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/sliding-window/3-longest-substring-without-repeating-characters.mdx b/apps/docs/content/(01-linear-structures)/sliding-window/3-longest-substring-without-repeating-characters.mdx index 3ba366b..868cb8b 100644 --- a/apps/docs/content/(01-linear-structures)/sliding-window/3-longest-substring-without-repeating-characters.mdx +++ b/apps/docs/content/(01-linear-structures)/sliding-window/3-longest-substring-without-repeating-characters.mdx @@ -2,13 +2,16 @@ title: '3. Longest Substring Without Repeating Characters' description: Given a string s, find the length of the longest substring without duplicate characters icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Sliding Window", slug: "sliding-window" } +video: "wiGpQwVHdE0" sidebar: label: 'Longest Substring Without Repeating Characters' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `s = "abcabcbb"` - Output: `3` @@ -61,7 +64,3 @@ class Solution: return ans ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/sliding-window/424-longest-repeating-character-replacement.mdx b/apps/docs/content/(01-linear-structures)/sliding-window/424-longest-repeating-character-replacement.mdx index c1b2d87..b4edf7a 100644 --- a/apps/docs/content/(01-linear-structures)/sliding-window/424-longest-repeating-character-replacement.mdx +++ b/apps/docs/content/(01-linear-structures)/sliding-window/424-longest-repeating-character-replacement.mdx @@ -2,13 +2,16 @@ title: '424. Longest Repeating Character Replacement' description: You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Sliding Window", slug: "sliding-window" } +video: "gqXU1UyA8pk" sidebar: label: 'Longest Repeating Character Replacement' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `s = "ABAB", k = 2` - Output: `4` @@ -61,7 +64,3 @@ class Solution: res = max(res, r - l + 1) return res ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/sliding-window/567-permutation-in-string.mdx b/apps/docs/content/(01-linear-structures)/sliding-window/567-permutation-in-string.mdx index b4b50a3..5f8d189 100644 --- a/apps/docs/content/(01-linear-structures)/sliding-window/567-permutation-in-string.mdx +++ b/apps/docs/content/(01-linear-structures)/sliding-window/567-permutation-in-string.mdx @@ -2,13 +2,17 @@ title: '567. Permutation in String' description: Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "String", slug: "string" } + - { name: "Sliding Window", slug: "sliding-window" } +video: "UbyhOgBN834" sidebar: label: 'Permutation in String' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `s1 = "ab", s2 = "eidbaooo"` - Output: `true` @@ -68,7 +72,3 @@ class Solution: return False ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/stack/150-evaluate-reverse-polish-notation.mdx b/apps/docs/content/(01-linear-structures)/stack/150-evaluate-reverse-polish-notation.mdx index 53cb814..6b18883 100644 --- a/apps/docs/content/(01-linear-structures)/stack/150-evaluate-reverse-polish-notation.mdx +++ b/apps/docs/content/(01-linear-structures)/stack/150-evaluate-reverse-polish-notation.mdx @@ -2,13 +2,16 @@ title: '150. Evaluate Reverse Polish Notation' description: You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Math", slug: "math" } + - { name: "Stack", slug: "stack" } +video: "iu0082c4HDE" sidebar: label: 'Evaluate Reverse Polish Notation' badge: 'Medium' --- -Array - ### Example 1: - Input: `tokens = ["2","1","+","3","*"]` - Output: `9` @@ -69,7 +72,3 @@ class Solution: return stack[0] ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/stack/155-min-stack.mdx b/apps/docs/content/(01-linear-structures)/stack/155-min-stack.mdx index ab2d7b5..36481f2 100644 --- a/apps/docs/content/(01-linear-structures)/stack/155-min-stack.mdx +++ b/apps/docs/content/(01-linear-structures)/stack/155-min-stack.mdx @@ -2,13 +2,15 @@ title: '155. Min Stack' description: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time icon: dot +topics: + - { name: "Stack", slug: "stack" } + - { name: "Design", slug: "design" } +video: "qkLl7nAwDPo" sidebar: label: 'Min Stack' badge: 'Medium' --- -Stack - ::::warning You must implement a solution with O(1) time complexity for each function. :::: @@ -77,7 +79,3 @@ class MinStack: # param_3 = obj.top() # param_4 = obj.getMin() ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/stack/20-valid-parentheses.mdx b/apps/docs/content/(01-linear-structures)/stack/20-valid-parentheses.mdx index ffca734..fa7c1b5 100644 --- a/apps/docs/content/(01-linear-structures)/stack/20-valid-parentheses.mdx +++ b/apps/docs/content/(01-linear-structures)/stack/20-valid-parentheses.mdx @@ -2,13 +2,16 @@ title: '20. Valid Parentheses' description: Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid icon: dot +topics: + - { name: "String", slug: "string" } + - { name: "Stack", slug: "stack" } + - { name: "Bracket Sequences", slug: "bracket-sequences" } +video: "WTzjTskDFMg" sidebar: label: 'Valid Parentheses' badge: 'Easy' --- -String - ### Example 1: - Input: `s = "()"` - Output: `true` @@ -71,7 +74,3 @@ class Solution: return True if not stack else False ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/11-container-with-most-water.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/11-container-with-most-water.mdx index 0773e63..a8facd9 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/11-container-with-most-water.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/11-container-with-most-water.mdx @@ -2,13 +2,16 @@ title: '11. Container With Most Water' description: You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the i^th line are (i, 0) and (i, height[i]) icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "Greedy", slug: "greedy" } +video: "UuiTKBwPgAo" sidebar: label: 'Container With Most Water' badge: 'Medium' --- -Array - ::::warning Notice that you may not slant the container. :::: @@ -63,7 +66,3 @@ class Solution: return res ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/125-valid-palindrome.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/125-valid-palindrome.mdx index 6ac36be..f02632c 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/125-valid-palindrome.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/125-valid-palindrome.mdx @@ -2,13 +2,15 @@ title: '125. Valid Palindrome' description: A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers icon: dot +topics: + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "String", slug: "string" } +video: "jJXJ16kPFWg" sidebar: label: 'Valid Palindrome' badge: 'Easy' --- -Two Pointers - ### Example 1: - Input: `s = "A man, a plan, a canal: Panama"` - Output: `true` @@ -64,7 +66,3 @@ var isPalindrome = function(s) { return true; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/15-3sum.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/15-3sum.mdx index 8b4faf3..c773807 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/15-3sum.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/15-3sum.mdx @@ -2,13 +2,16 @@ title: '15. 3Sum' description: Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0 icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "Sorting", slug: "sorting" } +video: "jzZsG8n2R9A" sidebar: label: '3Sum' badge: 'Medium' --- -Array - ::::warning Notice that the solution set must not contain duplicate triplets. :::: @@ -99,7 +102,3 @@ class Solution: return result ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/167-two-sum-ii-input-array-is-sorted.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/167-two-sum-ii-input-array-is-sorted.mdx index 4ccf28b..2f4e59a 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/167-two-sum-ii-input-array-is-sorted.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/167-two-sum-ii-input-array-is-sorted.mdx @@ -2,13 +2,16 @@ title: '167. Two Sum II - Input Array Is Sorted' description: Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "Binary Search", slug: "binary-search" } +video: "cQ1Oz4ckceM" sidebar: label: 'Two Sum II - Input Array Is Sorted' badge: 'Medium' --- -Array - ::::warning Your solution must use only constant extra space. :::: @@ -70,7 +73,3 @@ class Solution: j-=1 return [] ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/344-reverse-string.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/344-reverse-string.mdx index bef6c24..a421e58 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/344-reverse-string.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/344-reverse-string.mdx @@ -2,13 +2,15 @@ title: '344. Reverse String' description: Write a function that reverses a string. The input string is given as an array of characters s icon: dot +topics: + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "String", slug: "string" } +video: "_d0T_2Lk2qA" sidebar: label: 'Reverse String' badge: 'Easy' --- -Two Pointers - :::warning You must do this by modifying the input array in-place with O(1) extra memory. ::: @@ -56,7 +58,3 @@ var reverseString = function(s) { } }; ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/392-is-subsequence.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/392-is-subsequence.mdx index 222cd17..7fab620 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/392-is-subsequence.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/392-is-subsequence.mdx @@ -2,13 +2,16 @@ title: '392. Is Subsequence' description: Given two strings s and t, return true if s is a subsequence of t, or false otherwise icon: dot +topics: + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "String", slug: "string" } + - { name: "Dynamic Programming", slug: "dynamic-programming" } +video: "99RVfqklbCE" sidebar: label: 'Is Subsequence' badge: 'Easy' --- -Two Pointers - ::::warning Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 10^9, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code? :::: @@ -59,7 +62,3 @@ class Solution: return i == len(s) ``` - -## Explanation - - diff --git a/apps/docs/content/(01-linear-structures)/two-pointers/977-squares-of-a-sorted-array.mdx b/apps/docs/content/(01-linear-structures)/two-pointers/977-squares-of-a-sorted-array.mdx index 144a6c6..efbdc02 100644 --- a/apps/docs/content/(01-linear-structures)/two-pointers/977-squares-of-a-sorted-array.mdx +++ b/apps/docs/content/(01-linear-structures)/two-pointers/977-squares-of-a-sorted-array.mdx @@ -2,13 +2,16 @@ title: '977. Squares of a Sorted Array' description: Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "Sorting", slug: "sorting" } +video: "FPCZsG_AkUg" sidebar: label: 'Squares of a Sorted Array' badge: 'Easy' --- -Array - ::::warning Squaring each element and sorting the new array is very trivial, could you find an O(n) solution using a different approach? :::: @@ -69,7 +72,3 @@ var sortedSquares = function(nums) { return ans; }; ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/hybrid-structures/146-lru-cache.mdx b/apps/docs/content/(02-nodal-grid)/hybrid-structures/146-lru-cache.mdx index bed410c..e2cfa0a 100644 --- a/apps/docs/content/(02-nodal-grid)/hybrid-structures/146-lru-cache.mdx +++ b/apps/docs/content/(02-nodal-grid)/hybrid-structures/146-lru-cache.mdx @@ -2,13 +2,17 @@ title: '146. LRU Cache' description: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "Linked List", slug: "linked-list" } + - { name: "Design", slug: "design" } + - { name: "Doubly-Linked List", slug: "doubly-linked-list" } +video: "7ABFKPK2hD4" sidebar: label: 'LRU Cache' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `` - Output: `` @@ -110,7 +114,3 @@ class LRUCache: # param_1 = obj.get(key) # obj.put(key,value) ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/hybrid-structures/2-add-two-numbers.mdx b/apps/docs/content/(02-nodal-grid)/hybrid-structures/2-add-two-numbers.mdx index 935a9e6..a922d1c 100644 --- a/apps/docs/content/(02-nodal-grid)/hybrid-structures/2-add-two-numbers.mdx +++ b/apps/docs/content/(02-nodal-grid)/hybrid-structures/2-add-two-numbers.mdx @@ -2,13 +2,16 @@ title: '2. Add Two Numbers' description: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list icon: dot +topics: + - { name: "Linked List", slug: "linked-list" } + - { name: "Math", slug: "math" } + - { name: "Recursion", slug: "recursion" } +video: "wgFPrzTjm7s" sidebar: label: 'Add Two Numbers' badge: 'Medium' --- -Linked List - ### Example 1: - Input: `l1 = [2,4,3], l2 = [5,6,4]` - Output: `[7,0,8]` @@ -70,7 +73,3 @@ class Solution: return dummy.next ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/linked-list/141-linked-list-cycle.mdx b/apps/docs/content/(02-nodal-grid)/linked-list/141-linked-list-cycle.mdx index 7888f96..dca2a6f 100644 --- a/apps/docs/content/(02-nodal-grid)/linked-list/141-linked-list-cycle.mdx +++ b/apps/docs/content/(02-nodal-grid)/linked-list/141-linked-list-cycle.mdx @@ -2,13 +2,17 @@ title: '141. Linked List Cycle' description: Given head, the head of a linked list, determine if the linked list has a cycle in it icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "Linked List", slug: "linked-list" } + - { name: "Two Pointers", slug: "two-pointers" } + - { name: "Floyd's Cycle Finding Algorithm", slug: "floyds-cycle-finding-algorithm" } +video: "gBTe7lFR3vc" sidebar: label: 'Linked List Cycle' badge: 'Easy' --- -Hash Table - ::::warning Can you solve it using O(1) (i.e. constant) memory? :::: @@ -69,7 +73,3 @@ class Solution: return True return False ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/linked-list/206-reverse-linked-list.mdx b/apps/docs/content/(02-nodal-grid)/linked-list/206-reverse-linked-list.mdx index cb90bb8..f665b12 100644 --- a/apps/docs/content/(02-nodal-grid)/linked-list/206-reverse-linked-list.mdx +++ b/apps/docs/content/(02-nodal-grid)/linked-list/206-reverse-linked-list.mdx @@ -2,13 +2,15 @@ title: '206. Reverse Linked List' description: Given the head of a singly linked list, reverse the list, and return the reversed list icon: dot +topics: + - { name: "Linked List", slug: "linked-list" } + - { name: "Recursion", slug: "recursion" } +video: "G0_I-ZF0S38" sidebar: label: 'Reverse Linked List' badge: 'Easy' --- -Linked List - ::::warning A linked list can be reversed either iteratively or recursively. Could you implement both? :::: @@ -62,7 +64,3 @@ class Solution: curr = next_ return prev ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/linked-list/21-merge-two-sorted-lists.mdx b/apps/docs/content/(02-nodal-grid)/linked-list/21-merge-two-sorted-lists.mdx index af967a6..650e88c 100644 --- a/apps/docs/content/(02-nodal-grid)/linked-list/21-merge-two-sorted-lists.mdx +++ b/apps/docs/content/(02-nodal-grid)/linked-list/21-merge-two-sorted-lists.mdx @@ -2,13 +2,15 @@ title: '21. Merge Two Sorted Lists' description: You are given the heads of two sorted linked lists list1 and list2 icon: dot +topics: + - { name: "Linked List", slug: "linked-list" } + - { name: "Recursion", slug: "recursion" } +video: "XIdigk956u0" sidebar: label: 'Merge Two Sorted Lists' badge: 'Easy' --- -Linked List - ### Example 1: - Input: `list1 = [1,2,4], list2 = [1,3,4]` - Output: `[1,1,2,3,4,4]` @@ -82,7 +84,3 @@ class Solution: current.next = list1 or list2 return head ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/matrix-index-math/48-rotate-image.mdx b/apps/docs/content/(02-nodal-grid)/matrix-index-math/48-rotate-image.mdx index e5e8754..cd6d057 100644 --- a/apps/docs/content/(02-nodal-grid)/matrix-index-math/48-rotate-image.mdx +++ b/apps/docs/content/(02-nodal-grid)/matrix-index-math/48-rotate-image.mdx @@ -2,13 +2,16 @@ title: '48. Rotate Image' description: You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise) icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Math", slug: "math" } + - { name: "Matrix", slug: "matrix" } +video: "fMSJSS7eO1w" sidebar: label: 'Rotate Image' badge: 'Medium' --- -Array - ### Example 1: - Input: `matrix = [[1,2,3],[4,5,6],[7,8,9]]` - Output: `[[7,4,1],[8,5,2],[9,6,3]]` @@ -52,7 +55,3 @@ class Solution: for r in range(n): matrix[r].reverse() ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/matrix-index-math/54-spiral-matrix.mdx b/apps/docs/content/(02-nodal-grid)/matrix-index-math/54-spiral-matrix.mdx index b402466..e1d400b 100644 --- a/apps/docs/content/(02-nodal-grid)/matrix-index-math/54-spiral-matrix.mdx +++ b/apps/docs/content/(02-nodal-grid)/matrix-index-math/54-spiral-matrix.mdx @@ -2,13 +2,16 @@ title: '54. Spiral Matrix' description: Given an m x n matrix, return all elements of the matrix in spiral order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Matrix", slug: "matrix" } + - { name: "Simulation", slug: "simulation" } +video: "BJnMZNwUk1M" sidebar: label: 'Spiral Matrix' badge: 'Medium' --- -Array - ### Example 1: - Input: `matrix = [[1,2,3],[4,5,6],[7,8,9]]` - Output: `[1,2,3,6,9,8,7,4,5]` @@ -76,7 +79,3 @@ class Solution: return res ``` - -## Explanation - - diff --git a/apps/docs/content/(02-nodal-grid)/matrix-index-math/73-set-matrix-zeroes.mdx b/apps/docs/content/(02-nodal-grid)/matrix-index-math/73-set-matrix-zeroes.mdx index 5508041..8520e8e 100644 --- a/apps/docs/content/(02-nodal-grid)/matrix-index-math/73-set-matrix-zeroes.mdx +++ b/apps/docs/content/(02-nodal-grid)/matrix-index-math/73-set-matrix-zeroes.mdx @@ -2,13 +2,16 @@ title: '73. Set Matrix Zeroes' description: Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Hash Table", slug: "hash-table" } + - { name: "Matrix", slug: "matrix" } +video: "T41rL0L3Pnw" sidebar: label: 'Set Matrix Zeroes' badge: 'Medium' --- -Array - ::::warning You must do it in place. :::: @@ -95,7 +98,3 @@ class Solution: for r in range(m): matrix[r][0] = 0 ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/binary-search-tree/230-kth-smallest-element-in-a-bst.mdx b/apps/docs/content/(03-hierarchical)/binary-search-tree/230-kth-smallest-element-in-a-bst.mdx index ddd555e..6a6dbad 100644 --- a/apps/docs/content/(03-hierarchical)/binary-search-tree/230-kth-smallest-element-in-a-bst.mdx +++ b/apps/docs/content/(03-hierarchical)/binary-search-tree/230-kth-smallest-element-in-a-bst.mdx @@ -2,13 +2,17 @@ title: '230. Kth Smallest Element in a BST' description: Given the root of a binary search tree, and an integer k, return the k^th smallest value (1-indexed) of all the values of the nodes in the tree icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Binary Search Tree", slug: "binary-search-tree" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "5LUXSvjmGCw" sidebar: label: 'Kth Smallest Element in a BST' badge: 'Medium' --- -Tree - ::::warning If the BST is modified often (i.e., we can do insert and delete operations) and you need to find the kth smallest frequently, how would you optimize? :::: @@ -70,7 +74,3 @@ class Solution: return cur.val cur = cur.right ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.mdx b/apps/docs/content/(03-hierarchical)/binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.mdx index 456f6db..88e60f3 100644 --- a/apps/docs/content/(03-hierarchical)/binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.mdx @@ -2,13 +2,19 @@ title: '235. Lowest Common Ancestor of a Binary Search Tree' description: Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Binary Search Tree", slug: "binary-search-tree" } + - { name: "Binary Tree", slug: "binary-tree" } + - { name: "Binary Lifting", slug: "binary-lifting" } + - { name: "Lowest Common Ancestor", slug: "lowest-common-ancestor" } +video: "gs2LMfuOR9k" sidebar: label: 'Lowest Common Ancestor of a Binary Search Tree' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 8` - Output: `6` @@ -71,7 +77,3 @@ class Solution: else: return cur ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/binary-search-tree/98-validate-binary-search-tree.mdx b/apps/docs/content/(03-hierarchical)/binary-search-tree/98-validate-binary-search-tree.mdx index 2961c25..964de7e 100644 --- a/apps/docs/content/(03-hierarchical)/binary-search-tree/98-validate-binary-search-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/binary-search-tree/98-validate-binary-search-tree.mdx @@ -2,13 +2,17 @@ title: '98. Validate Binary Search Tree' description: Given the root of a binary tree, determine if it is a valid binary search tree (BST) icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Binary Search Tree", slug: "binary-search-tree" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "s6ATEkipzow" sidebar: label: 'Validate Binary Search Tree' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [2,1,3]` - Output: `true` @@ -62,7 +66,3 @@ class Solution: return valid(root, float("-inf"), float("inf")) ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/heap-priority-queue/215-kth-largest-element-in-an-array.mdx b/apps/docs/content/(03-hierarchical)/heap-priority-queue/215-kth-largest-element-in-an-array.mdx index 766365d..0a14ddf 100644 --- a/apps/docs/content/(03-hierarchical)/heap-priority-queue/215-kth-largest-element-in-an-array.mdx +++ b/apps/docs/content/(03-hierarchical)/heap-priority-queue/215-kth-largest-element-in-an-array.mdx @@ -2,13 +2,18 @@ title: '215. Kth Largest Element in an Array' description: Given an integer array nums and an integer k, return the k^th largest element in the array icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Divide and Conquer", slug: "divide-and-conquer" } + - { name: "Sorting", slug: "sorting" } + - { name: "Heap (Priority Queue)", slug: "heap-priority-queue" } + - { name: "Quickselect", slug: "quickselect" } +video: "XEmy13g1Qxc" sidebar: label: 'Kth Largest Element in an Array' badge: 'Medium' --- -Array - ### Example 1: - Input: `nums = [3,2,1,5,6,4], k = 2` - Output: `5` @@ -54,7 +59,3 @@ class Solution: return -heapq.heappop(nums) ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/heap-priority-queue/23-merge-k-sorted-lists.mdx b/apps/docs/content/(03-hierarchical)/heap-priority-queue/23-merge-k-sorted-lists.mdx index 5bea9f6..b5ac036 100644 --- a/apps/docs/content/(03-hierarchical)/heap-priority-queue/23-merge-k-sorted-lists.mdx +++ b/apps/docs/content/(03-hierarchical)/heap-priority-queue/23-merge-k-sorted-lists.mdx @@ -2,13 +2,18 @@ title: '23. Merge k Sorted Lists' description: You are given an array of k linked-lists lists, each linked-list is sorted in ascending order icon: dot +topics: + - { name: "Linked List", slug: "linked-list" } + - { name: "Divide and Conquer", slug: "divide-and-conquer" } + - { name: "Heap (Priority Queue)", slug: "heap-priority-queue" } + - { name: "Merge Sort", slug: "merge-sort" } + - { name: "Tournament Sort", slug: "tournament-sort" } +video: "q5a5OiGbT6Q" sidebar: label: 'Merge k Sorted Lists' badge: 'Hard' --- -Linked List - ### Example 1: - Input: `lists = [[1,4,5],[1,3,4],[2,6]]` - Output: `[1,1,2,3,4,4,5,6]` @@ -89,7 +94,3 @@ class Solution: # Space: O(n) return D.next ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/heap-priority-queue/973-k-closest-points-to-origin.mdx b/apps/docs/content/(03-hierarchical)/heap-priority-queue/973-k-closest-points-to-origin.mdx index 87b1796..0291cd7 100644 --- a/apps/docs/content/(03-hierarchical)/heap-priority-queue/973-k-closest-points-to-origin.mdx +++ b/apps/docs/content/(03-hierarchical)/heap-priority-queue/973-k-closest-points-to-origin.mdx @@ -2,13 +2,21 @@ title: '973. K Closest Points to Origin' description: Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0) icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Math", slug: "math" } + - { name: "Divide and Conquer", slug: "divide-and-conquer" } + - { name: "Geometry", slug: "geometry" } + - { name: "Sorting", slug: "sorting" } + - { name: "Heap (Priority Queue)", slug: "heap-priority-queue" } + - { name: "Quickselect", slug: "quickselect" } + - { name: "K-D Tree", slug: "k-d-tree" } +video: "rI2EBUEMfTk" sidebar: label: 'K Closest Points to Origin' badge: 'Medium' --- -Array - ### Example 1: - Input: `points = [[1,3],[-2,2]], k = 1` - Output: `[[-2,2]]` @@ -64,7 +72,3 @@ class Solution: return res ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-bfs/102-binary-tree-level-order-traversal.mdx b/apps/docs/content/(03-hierarchical)/tree-bfs/102-binary-tree-level-order-traversal.mdx index e1b0abc..89b2ffc 100644 --- a/apps/docs/content/(03-hierarchical)/tree-bfs/102-binary-tree-level-order-traversal.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-bfs/102-binary-tree-level-order-traversal.mdx @@ -2,13 +2,16 @@ title: '102. Binary Tree Level Order Traversal' description: Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level) icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "6ZnyEApgFYg" sidebar: label: 'Binary Tree Level Order Traversal' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [3,9,20,null,null,15,7]` - Output: `[[3],[9,20],[15,7]]` @@ -80,7 +83,3 @@ class Solution: return res ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-bfs/1448-count-good-nodes-in-binary-tree.mdx b/apps/docs/content/(03-hierarchical)/tree-bfs/1448-count-good-nodes-in-binary-tree.mdx index 3386bdd..a4e5c6a 100644 --- a/apps/docs/content/(03-hierarchical)/tree-bfs/1448-count-good-nodes-in-binary-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-bfs/1448-count-good-nodes-in-binary-tree.mdx @@ -2,13 +2,17 @@ title: '1448. Count Good Nodes in Binary Tree' description: Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "7cp5imvDzl4" sidebar: label: 'Count Good Nodes in Binary Tree' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [3,1,4,3,null,1,5]` - Output: `4` @@ -67,7 +71,3 @@ class Solution: return dfs(root, root.val) ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-bfs/199-binary-tree-right-side-view.mdx b/apps/docs/content/(03-hierarchical)/tree-bfs/199-binary-tree-right-side-view.mdx index 2640241..68bdac9 100644 --- a/apps/docs/content/(03-hierarchical)/tree-bfs/199-binary-tree-right-side-view.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-bfs/199-binary-tree-right-side-view.mdx @@ -2,13 +2,17 @@ title: '199. Binary Tree Right Side View' description: Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "d4zLyf32e3I" sidebar: label: 'Binary Tree Right Side View' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [1,2,3,null,5,null,4]` - Output: `[1,3,4]` @@ -83,7 +87,3 @@ class Solution: return res ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-dfs/104-maximum-depth-of-binary-tree.mdx b/apps/docs/content/(03-hierarchical)/tree-dfs/104-maximum-depth-of-binary-tree.mdx index ae9ccb6..7833856 100644 --- a/apps/docs/content/(03-hierarchical)/tree-dfs/104-maximum-depth-of-binary-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-dfs/104-maximum-depth-of-binary-tree.mdx @@ -2,13 +2,17 @@ title: '104. Maximum Depth of Binary Tree' description: Given the root of a binary tree, return its maximum depth icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "hTM3phVI6YQ" sidebar: label: 'Maximum Depth of Binary Tree' badge: 'Easy' --- -Tree - ### Example 1: - Input: `root = [3,9,20,null,null,15,7]` - Output: `3` @@ -48,7 +52,3 @@ class Solution: return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-dfs/226-invert-binary-tree.mdx b/apps/docs/content/(03-hierarchical)/tree-dfs/226-invert-binary-tree.mdx index c2853f1..986b39e 100644 --- a/apps/docs/content/(03-hierarchical)/tree-dfs/226-invert-binary-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-dfs/226-invert-binary-tree.mdx @@ -2,13 +2,17 @@ title: '226. Invert Binary Tree' description: Given the root of a binary tree, invert the tree, and return its root icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } +video: "OnSn2XEQ4MY" sidebar: label: 'Invert Binary Tree' badge: 'Easy' --- -Tree - ### Example 1: - Input: `root = [4,2,7,1,3,6,9]` - Output: `[4,7,2,9,6,3,1]` @@ -59,7 +63,3 @@ class Solution: return root ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/tree-dfs/236-lowest-common-ancestor-of-a-binary-tree.mdx b/apps/docs/content/(03-hierarchical)/tree-dfs/236-lowest-common-ancestor-of-a-binary-tree.mdx index 13f0f72..b2aca2e 100644 --- a/apps/docs/content/(03-hierarchical)/tree-dfs/236-lowest-common-ancestor-of-a-binary-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/tree-dfs/236-lowest-common-ancestor-of-a-binary-tree.mdx @@ -2,13 +2,17 @@ title: '236. Lowest Common Ancestor of a Binary Tree' description: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree icon: dot +topics: + - { name: "Tree", slug: "tree" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Binary Tree", slug: "binary-tree" } + - { name: "Binary Lifting", slug: "binary-lifting" } + - { name: "Lowest Common Ancestor", slug: "lowest-common-ancestor" } sidebar: label: 'Lowest Common Ancestor of a Binary Tree' badge: 'Medium' --- -Tree - ### Example 1: - Input: `root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1` - Output: `3` diff --git a/apps/docs/content/(03-hierarchical)/trie/208-implement-trie-prefix-tree.mdx b/apps/docs/content/(03-hierarchical)/trie/208-implement-trie-prefix-tree.mdx index 3480dd5..fe0d305 100644 --- a/apps/docs/content/(03-hierarchical)/trie/208-implement-trie-prefix-tree.mdx +++ b/apps/docs/content/(03-hierarchical)/trie/208-implement-trie-prefix-tree.mdx @@ -2,13 +2,17 @@ title: '208. Implement Trie (Prefix Tree)' description: A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Design", slug: "design" } + - { name: "Trie", slug: "trie" } +video: "oobqoCJlHA0" sidebar: label: 'Implement Trie (Prefix Tree)' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `` - Output: `` @@ -107,7 +111,3 @@ class Trie: # param_2 = obj.search(word) # param_3 = obj.startsWith(prefix) ``` - -## Explanation - - diff --git a/apps/docs/content/(03-hierarchical)/trie/211-design-add-and-search-words-data-structure.mdx b/apps/docs/content/(03-hierarchical)/trie/211-design-add-and-search-words-data-structure.mdx index e3e3c62..6b5b036 100644 --- a/apps/docs/content/(03-hierarchical)/trie/211-design-add-and-search-words-data-structure.mdx +++ b/apps/docs/content/(03-hierarchical)/trie/211-design-add-and-search-words-data-structure.mdx @@ -2,13 +2,17 @@ title: '211. Design Add and Search Words Data Structure' description: Design a data structure that supports adding new words and finding if a string matches any previously added string icon: dot +topics: + - { name: "String", slug: "string" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Design", slug: "design" } + - { name: "Trie", slug: "trie" } +video: "BTf05gs_8iU" sidebar: label: 'Design Add and Search Words Data Structure' badge: 'Medium' --- -String - ### Constraints: - `1 <= word.length <= 25` @@ -101,7 +105,3 @@ class WordDictionary: # obj.addWord(word) # param_3 = obj.search(word) ``` - -## Explanation - - diff --git a/apps/docs/content/(04-relational)/graph-bfs/127-word-ladder.mdx b/apps/docs/content/(04-relational)/graph-bfs/127-word-ladder.mdx index 8f448eb..7e080c6 100644 --- a/apps/docs/content/(04-relational)/graph-bfs/127-word-ladder.mdx +++ b/apps/docs/content/(04-relational)/graph-bfs/127-word-ladder.mdx @@ -2,13 +2,16 @@ title: '127. Word Ladder' description: 'A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:' icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "String", slug: "string" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Bidirectional Search", slug: "bidirectional-search" } sidebar: label: 'Word Ladder' badge: 'Hard' --- -Hash Table - ### Example 1: - Input: `beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]` - Output: `5` diff --git a/apps/docs/content/(04-relational)/graph-bfs/994-rotting-oranges.mdx b/apps/docs/content/(04-relational)/graph-bfs/994-rotting-oranges.mdx index 761a775..592fa37 100644 --- a/apps/docs/content/(04-relational)/graph-bfs/994-rotting-oranges.mdx +++ b/apps/docs/content/(04-relational)/graph-bfs/994-rotting-oranges.mdx @@ -2,13 +2,15 @@ title: '994. Rotting Oranges' description: 'You are given an m x n grid where each cell can have one of three values:' icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Matrix", slug: "matrix" } sidebar: label: 'Rotting Oranges' badge: 'Medium' --- -Array - ### Example 1: - Input: `grid = [[2,1,1],[1,1,0],[0,1,1]]` - Output: `4` diff --git a/apps/docs/content/(04-relational)/graph-dfs/133-clone-graph.mdx b/apps/docs/content/(04-relational)/graph-dfs/133-clone-graph.mdx index 308d1a0..7fb5d5e 100644 --- a/apps/docs/content/(04-relational)/graph-dfs/133-clone-graph.mdx +++ b/apps/docs/content/(04-relational)/graph-dfs/133-clone-graph.mdx @@ -2,13 +2,16 @@ title: '133. Clone Graph' description: Given a reference of a node in a connected undirected graph icon: dot +topics: + - { name: "Hash Table", slug: "hash-table" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Graph Theory", slug: "graph" } sidebar: label: 'Clone Graph' badge: 'Medium' --- -Hash Table - ### Example 1: - Input: `adjList = [[2,4],[1,3],[2,4],[1,3]]` - Output: `[[2,4],[1,3],[2,4],[1,3]]` diff --git a/apps/docs/content/(04-relational)/graph-dfs/200-number-of-islands.mdx b/apps/docs/content/(04-relational)/graph-dfs/200-number-of-islands.mdx index f82ce6a..cdf70f9 100644 --- a/apps/docs/content/(04-relational)/graph-dfs/200-number-of-islands.mdx +++ b/apps/docs/content/(04-relational)/graph-dfs/200-number-of-islands.mdx @@ -2,13 +2,17 @@ title: '200. Number of Islands' description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Union-Find", slug: "union-find" } + - { name: "Matrix", slug: "matrix" } sidebar: label: 'Number of Islands' badge: 'Medium' --- -Array - ### Example 1: - Input: `grid = [ ["1","1","1","1","0"], ["1","1","0","1","0"], ["1","1","0","0","0"], ["0","0","0","0","0"] ]` - Output: `1` diff --git a/apps/docs/content/(04-relational)/graph-dfs/417-pacific-atlantic-water-flow.mdx b/apps/docs/content/(04-relational)/graph-dfs/417-pacific-atlantic-water-flow.mdx index 2ff5851..1eff7a6 100644 --- a/apps/docs/content/(04-relational)/graph-dfs/417-pacific-atlantic-water-flow.mdx +++ b/apps/docs/content/(04-relational)/graph-dfs/417-pacific-atlantic-water-flow.mdx @@ -2,13 +2,16 @@ title: '417. Pacific Atlantic Water Flow' description: There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Matrix", slug: "matrix" } sidebar: label: 'Pacific Atlantic Water Flow' badge: 'Medium' --- -Array - ### Example 1: - Input: `heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]` - Output: `[[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]]` diff --git a/apps/docs/content/(04-relational)/topological-sort/207-course-schedule.mdx b/apps/docs/content/(04-relational)/topological-sort/207-course-schedule.mdx index 805acc5..5b8b902 100644 --- a/apps/docs/content/(04-relational)/topological-sort/207-course-schedule.mdx +++ b/apps/docs/content/(04-relational)/topological-sort/207-course-schedule.mdx @@ -2,13 +2,17 @@ title: '207. Course Schedule' description: There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai icon: dot +topics: + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Graph Theory", slug: "graph" } + - { name: "Topological Sort", slug: "topological-sort" } + - { name: "Directed Acyclic Graph", slug: "directed-acyclic-graph" } sidebar: label: 'Course Schedule' badge: 'Medium' --- -Depth-First Search - ### Example 1: - Input: `numCourses = 2, prerequisites = [[1,0]]` - Output: `true` diff --git a/apps/docs/content/(04-relational)/topological-sort/210-course-schedule-ii.mdx b/apps/docs/content/(04-relational)/topological-sort/210-course-schedule-ii.mdx index c9fe4e8..7dec059 100644 --- a/apps/docs/content/(04-relational)/topological-sort/210-course-schedule-ii.mdx +++ b/apps/docs/content/(04-relational)/topological-sort/210-course-schedule-ii.mdx @@ -2,13 +2,16 @@ title: '210. Course Schedule II' description: There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai icon: dot +topics: + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Graph Theory", slug: "graph" } + - { name: "Topological Sort", slug: "topological-sort" } sidebar: label: 'Course Schedule II' badge: 'Medium' --- -Depth-First Search - ### Example 1: - Input: `numCourses = 2, prerequisites = [[1,0]]` - Output: `[0,1]` diff --git a/apps/docs/content/(04-relational)/union-find/323-number-of-connected-components-in-an-undirected-graph.mdx b/apps/docs/content/(04-relational)/union-find/323-number-of-connected-components-in-an-undirected-graph.mdx index bd7675d..2222441 100644 --- a/apps/docs/content/(04-relational)/union-find/323-number-of-connected-components-in-an-undirected-graph.mdx +++ b/apps/docs/content/(04-relational)/union-find/323-number-of-connected-components-in-an-undirected-graph.mdx @@ -2,13 +2,16 @@ title: '323. Number of Connected Components in an Undirected Graph' description: You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph icon: dot +topics: + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Union-Find", slug: "union-find" } + - { name: "Graph Theory", slug: "graph" } sidebar: label: 'Number of Connected Components in an Undirected Graph' badge: 'Medium' --- -Depth-First Search - ### Example 1: - Input: `n = 5, edges = [[0,1],[1,2],[3,4]]` - Output: `2` diff --git a/apps/docs/content/(04-relational)/union-find/684-redundant-connection.mdx b/apps/docs/content/(04-relational)/union-find/684-redundant-connection.mdx index 1c0901c..a488d90 100644 --- a/apps/docs/content/(04-relational)/union-find/684-redundant-connection.mdx +++ b/apps/docs/content/(04-relational)/union-find/684-redundant-connection.mdx @@ -2,13 +2,16 @@ title: '684. Redundant Connection' description: In this problem, a tree is an undirected graph that is connected and has no cycles icon: dot +topics: + - { name: "Depth-First Search", slug: "depth-first-search" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Union-Find", slug: "union-find" } + - { name: "Graph Theory", slug: "graph" } sidebar: label: 'Redundant Connection' badge: 'Medium' --- -Depth-First Search - ### Example 1: - Input: `edges = [[1,2],[1,3],[2,3]]` - Output: `[2,3]` diff --git a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/198-house-robber.mdx b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/198-house-robber.mdx index e773984..e437faf 100644 --- a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/198-house-robber.mdx +++ b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/198-house-robber.mdx @@ -2,13 +2,14 @@ title: '198. House Robber' description: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Dynamic Programming", slug: "dynamic-programming" } sidebar: label: 'House Robber' badge: 'Medium' --- -Array - ### Example 1: - Input: `nums = [1,2,3,1]` - Output: `4` diff --git a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/322-coin-change.mdx b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/322-coin-change.mdx index 6774134..e69b165 100644 --- a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/322-coin-change.mdx +++ b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/322-coin-change.mdx @@ -2,13 +2,17 @@ title: '322. Coin Change' description: You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Dynamic Programming", slug: "dynamic-programming" } + - { name: "Breadth-First Search", slug: "breadth-first-search" } + - { name: "Knapsack Problem", slug: "knapsack-problem" } + - { name: "Complete Knapsack", slug: "complete-knapsack" } sidebar: label: 'Coin Change' badge: 'Medium' --- -Array - ### Example 1: - Input: `coins = [1,2,5], amount = 11` - Output: `3` diff --git a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/70-climbing-stairs.mdx b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/70-climbing-stairs.mdx index 11fc5af..9a13baf 100644 --- a/apps/docs/content/(05-decision-space)/1d-dynamic-programming/70-climbing-stairs.mdx +++ b/apps/docs/content/(05-decision-space)/1d-dynamic-programming/70-climbing-stairs.mdx @@ -2,13 +2,15 @@ title: '70. Climbing Stairs' description: You are climbing a staircase. It takes n steps to reach the top icon: dot +topics: + - { name: "Math", slug: "math" } + - { name: "Dynamic Programming", slug: "dynamic-programming" } + - { name: "Memoization", slug: "memoization" } sidebar: label: 'Climbing Stairs' badge: 'Easy' --- -Math - ### Example 1: - Input: `n = 2` - Output: `2` diff --git a/apps/docs/content/(05-decision-space)/backtracking/39-combination-sum.mdx b/apps/docs/content/(05-decision-space)/backtracking/39-combination-sum.mdx index 2610c8d..9012c47 100644 --- a/apps/docs/content/(05-decision-space)/backtracking/39-combination-sum.mdx +++ b/apps/docs/content/(05-decision-space)/backtracking/39-combination-sum.mdx @@ -2,13 +2,14 @@ title: '39. Combination Sum' description: Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Backtracking", slug: "backtracking" } sidebar: label: 'Combination Sum' badge: 'Medium' --- -Array - ### Example 1: - Input: `candidates = [2,3,6,7], target = 7` - Output: `[[2,2,3],[7]]` diff --git a/apps/docs/content/(05-decision-space)/backtracking/46-permutations.mdx b/apps/docs/content/(05-decision-space)/backtracking/46-permutations.mdx index e7fecd9..60dd7bf 100644 --- a/apps/docs/content/(05-decision-space)/backtracking/46-permutations.mdx +++ b/apps/docs/content/(05-decision-space)/backtracking/46-permutations.mdx @@ -2,13 +2,14 @@ title: '46. Permutations' description: Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Backtracking", slug: "backtracking" } sidebar: label: 'Permutations' badge: 'Medium' --- -Array - ### Example 1: - Input: `nums = [1,2,3]` - Output: `[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]` diff --git a/apps/docs/content/(05-decision-space)/backtracking/78-subsets.mdx b/apps/docs/content/(05-decision-space)/backtracking/78-subsets.mdx index 0b01063..55d6ae1 100644 --- a/apps/docs/content/(05-decision-space)/backtracking/78-subsets.mdx +++ b/apps/docs/content/(05-decision-space)/backtracking/78-subsets.mdx @@ -2,13 +2,15 @@ title: '78. Subsets' description: Given an integer array nums of unique elements, return all possible subsets (the power set) icon: dot +topics: + - { name: "Array", slug: "array" } + - { name: "Backtracking", slug: "backtracking" } + - { name: "Bit Manipulation", slug: "bit-manipulation" } sidebar: label: 'Subsets' badge: 'Medium' --- -Array - ### Example 1: - Input: `nums = [1,2,3]` - Output: `[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]` diff --git a/apps/docs/content/guides/array.mdx b/apps/docs/content/guides/array.mdx new file mode 100644 index 0000000..b73fd17 --- /dev/null +++ b/apps/docs/content/guides/array.mdx @@ -0,0 +1,8 @@ +--- +title: "Array" +list: "https://leetcode.com/problem-list/array/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Array. +::: diff --git a/apps/docs/content/guides/bidirectional-search.mdx b/apps/docs/content/guides/bidirectional-search.mdx new file mode 100644 index 0000000..87fcf32 --- /dev/null +++ b/apps/docs/content/guides/bidirectional-search.mdx @@ -0,0 +1,8 @@ +--- +title: "Bidirectional Search" +list: "https://leetcode.com/problem-list/bidirectional-search/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Bidirectional Search. +::: diff --git a/apps/docs/content/guides/binary-lifting.mdx b/apps/docs/content/guides/binary-lifting.mdx new file mode 100644 index 0000000..8d83202 --- /dev/null +++ b/apps/docs/content/guides/binary-lifting.mdx @@ -0,0 +1,8 @@ +--- +title: "Binary Lifting" +list: "https://leetcode.com/problem-list/binary-lifting/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Binary Lifting. +::: diff --git a/apps/docs/content/guides/binary-tree.mdx b/apps/docs/content/guides/binary-tree.mdx new file mode 100644 index 0000000..8d520c6 --- /dev/null +++ b/apps/docs/content/guides/binary-tree.mdx @@ -0,0 +1,8 @@ +--- +title: "Binary Tree" +list: "https://leetcode.com/problem-list/binary-tree/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Binary Tree. +::: diff --git a/apps/docs/content/guides/bit-manipulation.mdx b/apps/docs/content/guides/bit-manipulation.mdx new file mode 100644 index 0000000..82259c2 --- /dev/null +++ b/apps/docs/content/guides/bit-manipulation.mdx @@ -0,0 +1,8 @@ +--- +title: "Bit Manipulation" +list: "https://leetcode.com/problem-list/bit-manipulation/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Bit Manipulation. +::: diff --git a/apps/docs/content/guides/bracket-sequences.mdx b/apps/docs/content/guides/bracket-sequences.mdx new file mode 100644 index 0000000..3435df8 --- /dev/null +++ b/apps/docs/content/guides/bracket-sequences.mdx @@ -0,0 +1,8 @@ +--- +title: "Bracket Sequences" +list: "https://leetcode.com/problem-list/bracket-sequences/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Bracket Sequences. +::: diff --git a/apps/docs/content/guides/bucket-sort.mdx b/apps/docs/content/guides/bucket-sort.mdx new file mode 100644 index 0000000..a43f0f9 --- /dev/null +++ b/apps/docs/content/guides/bucket-sort.mdx @@ -0,0 +1,8 @@ +--- +title: "Bucket Sort" +list: "https://leetcode.com/problem-list/bucket-sort/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Bucket Sort. +::: diff --git a/apps/docs/content/guides/complete-knapsack.mdx b/apps/docs/content/guides/complete-knapsack.mdx new file mode 100644 index 0000000..0d1bb5f --- /dev/null +++ b/apps/docs/content/guides/complete-knapsack.mdx @@ -0,0 +1,8 @@ +--- +title: "Complete Knapsack" +list: "https://leetcode.com/problem-list/complete-knapsack/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Complete Knapsack. +::: diff --git a/apps/docs/content/guides/counting.mdx b/apps/docs/content/guides/counting.mdx new file mode 100644 index 0000000..0049d52 --- /dev/null +++ b/apps/docs/content/guides/counting.mdx @@ -0,0 +1,8 @@ +--- +title: "Counting" +list: "https://leetcode.com/problem-list/counting/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Counting. +::: diff --git a/apps/docs/content/guides/design.mdx b/apps/docs/content/guides/design.mdx new file mode 100644 index 0000000..9221f00 --- /dev/null +++ b/apps/docs/content/guides/design.mdx @@ -0,0 +1,8 @@ +--- +title: "Design" +list: "https://leetcode.com/problem-list/design/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Design. +::: diff --git a/apps/docs/content/guides/directed-acyclic-graph.mdx b/apps/docs/content/guides/directed-acyclic-graph.mdx new file mode 100644 index 0000000..b26a076 --- /dev/null +++ b/apps/docs/content/guides/directed-acyclic-graph.mdx @@ -0,0 +1,8 @@ +--- +title: "Directed Acyclic Graph" +list: "https://leetcode.com/problem-list/directed-acyclic-graph/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Directed Acyclic Graph. +::: diff --git a/apps/docs/content/guides/divide-and-conquer.mdx b/apps/docs/content/guides/divide-and-conquer.mdx new file mode 100644 index 0000000..7435376 --- /dev/null +++ b/apps/docs/content/guides/divide-and-conquer.mdx @@ -0,0 +1,8 @@ +--- +title: "Divide and Conquer" +list: "https://leetcode.com/problem-list/divide-and-conquer/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Divide and Conquer. +::: diff --git a/apps/docs/content/guides/doubly-linked-list.mdx b/apps/docs/content/guides/doubly-linked-list.mdx new file mode 100644 index 0000000..860043a --- /dev/null +++ b/apps/docs/content/guides/doubly-linked-list.mdx @@ -0,0 +1,8 @@ +--- +title: "Doubly-Linked List" +list: "https://leetcode.com/problem-list/doubly-linked-list/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Doubly-Linked List. +::: diff --git a/apps/docs/content/guides/floyds-cycle-finding-algorithm.mdx b/apps/docs/content/guides/floyds-cycle-finding-algorithm.mdx new file mode 100644 index 0000000..65fe1c5 --- /dev/null +++ b/apps/docs/content/guides/floyds-cycle-finding-algorithm.mdx @@ -0,0 +1,8 @@ +--- +title: "Floyd's Cycle Finding Algorithm" +list: "https://leetcode.com/problem-list/floyds-cycle-finding-algorithm/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Floyd's Cycle Finding Algorithm. +::: diff --git a/apps/docs/content/guides/geometry.mdx b/apps/docs/content/guides/geometry.mdx new file mode 100644 index 0000000..336c916 --- /dev/null +++ b/apps/docs/content/guides/geometry.mdx @@ -0,0 +1,8 @@ +--- +title: "Geometry" +list: "https://leetcode.com/problem-list/geometry/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Geometry. +::: diff --git a/apps/docs/content/guides/graph.mdx b/apps/docs/content/guides/graph.mdx new file mode 100644 index 0000000..9bba253 --- /dev/null +++ b/apps/docs/content/guides/graph.mdx @@ -0,0 +1,8 @@ +--- +title: "Graph Theory" +list: "https://leetcode.com/problem-list/graph/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Graph Theory. +::: diff --git a/apps/docs/content/guides/k-d-tree.mdx b/apps/docs/content/guides/k-d-tree.mdx new file mode 100644 index 0000000..27308df --- /dev/null +++ b/apps/docs/content/guides/k-d-tree.mdx @@ -0,0 +1,8 @@ +--- +title: "K-D Tree" +list: "https://leetcode.com/problem-list/k-d-tree/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged K-D Tree. +::: diff --git a/apps/docs/content/guides/knapsack-problem.mdx b/apps/docs/content/guides/knapsack-problem.mdx new file mode 100644 index 0000000..a16c986 --- /dev/null +++ b/apps/docs/content/guides/knapsack-problem.mdx @@ -0,0 +1,8 @@ +--- +title: "Knapsack Problem" +list: "https://leetcode.com/problem-list/knapsack-problem/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Knapsack Problem. +::: diff --git a/apps/docs/content/guides/lowest-common-ancestor.mdx b/apps/docs/content/guides/lowest-common-ancestor.mdx new file mode 100644 index 0000000..4e2fdad --- /dev/null +++ b/apps/docs/content/guides/lowest-common-ancestor.mdx @@ -0,0 +1,8 @@ +--- +title: "Lowest Common Ancestor" +list: "https://leetcode.com/problem-list/lowest-common-ancestor/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Lowest Common Ancestor. +::: diff --git a/apps/docs/content/guides/math.mdx b/apps/docs/content/guides/math.mdx new file mode 100644 index 0000000..20173e6 --- /dev/null +++ b/apps/docs/content/guides/math.mdx @@ -0,0 +1,8 @@ +--- +title: "Math" +list: "https://leetcode.com/problem-list/math/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Math. +::: diff --git a/apps/docs/content/guides/memoization.mdx b/apps/docs/content/guides/memoization.mdx new file mode 100644 index 0000000..8f1b163 --- /dev/null +++ b/apps/docs/content/guides/memoization.mdx @@ -0,0 +1,8 @@ +--- +title: "Memoization" +list: "https://leetcode.com/problem-list/memoization/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Memoization. +::: diff --git a/apps/docs/content/guides/merge-sort.mdx b/apps/docs/content/guides/merge-sort.mdx new file mode 100644 index 0000000..86235ec --- /dev/null +++ b/apps/docs/content/guides/merge-sort.mdx @@ -0,0 +1,8 @@ +--- +title: "Merge Sort" +list: "https://leetcode.com/problem-list/merge-sort/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Merge Sort. +::: diff --git a/apps/docs/content/guides/meta.ts b/apps/docs/content/guides/meta.ts new file mode 100644 index 0000000..bc56e7b --- /dev/null +++ b/apps/docs/content/guides/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Guides" }); diff --git a/apps/docs/content/guides/queue.mdx b/apps/docs/content/guides/queue.mdx new file mode 100644 index 0000000..f9a235b --- /dev/null +++ b/apps/docs/content/guides/queue.mdx @@ -0,0 +1,8 @@ +--- +title: "Queue" +list: "https://leetcode.com/problem-list/queue/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Queue. +::: diff --git a/apps/docs/content/guides/quickselect.mdx b/apps/docs/content/guides/quickselect.mdx new file mode 100644 index 0000000..1b8e436 --- /dev/null +++ b/apps/docs/content/guides/quickselect.mdx @@ -0,0 +1,8 @@ +--- +title: "Quickselect" +list: "https://leetcode.com/problem-list/quickselect/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Quickselect. +::: diff --git a/apps/docs/content/guides/recursion.mdx b/apps/docs/content/guides/recursion.mdx new file mode 100644 index 0000000..4966bc8 --- /dev/null +++ b/apps/docs/content/guides/recursion.mdx @@ -0,0 +1,8 @@ +--- +title: "Recursion" +list: "https://leetcode.com/problem-list/recursion/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Recursion. +::: diff --git a/apps/docs/content/guides/simulation.mdx b/apps/docs/content/guides/simulation.mdx new file mode 100644 index 0000000..85dd21e --- /dev/null +++ b/apps/docs/content/guides/simulation.mdx @@ -0,0 +1,8 @@ +--- +title: "Simulation" +list: "https://leetcode.com/problem-list/simulation/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Simulation. +::: diff --git a/apps/docs/content/guides/sorting.mdx b/apps/docs/content/guides/sorting.mdx new file mode 100644 index 0000000..2d216bb --- /dev/null +++ b/apps/docs/content/guides/sorting.mdx @@ -0,0 +1,8 @@ +--- +title: "Sorting" +list: "https://leetcode.com/problem-list/sorting/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Sorting. +::: diff --git a/apps/docs/content/guides/string.mdx b/apps/docs/content/guides/string.mdx new file mode 100644 index 0000000..78c6b10 --- /dev/null +++ b/apps/docs/content/guides/string.mdx @@ -0,0 +1,8 @@ +--- +title: "String" +list: "https://leetcode.com/problem-list/string/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged String. +::: diff --git a/apps/docs/content/guides/tournament-sort.mdx b/apps/docs/content/guides/tournament-sort.mdx new file mode 100644 index 0000000..f0022b7 --- /dev/null +++ b/apps/docs/content/guides/tournament-sort.mdx @@ -0,0 +1,8 @@ +--- +title: "Tournament Sort" +list: "https://leetcode.com/problem-list/tournament-sort/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Tournament Sort. +::: diff --git a/apps/docs/content/guides/tree.mdx b/apps/docs/content/guides/tree.mdx new file mode 100644 index 0000000..f0f3b47 --- /dev/null +++ b/apps/docs/content/guides/tree.mdx @@ -0,0 +1,8 @@ +--- +title: "Tree" +list: "https://leetcode.com/problem-list/tree/" +--- + +:::note +This guide has not been written yet. The LeetCode list above has every problem tagged Tree. +::: diff --git a/apps/docs/topic-landings.ts b/apps/docs/topic-landings.ts new file mode 100644 index 0000000..87a9c33 --- /dev/null +++ b/apps/docs/topic-landings.ts @@ -0,0 +1,35 @@ +/** + * LeetCode topic-tag slug → the campaign landing routes that teach it, in + * default preference order. The one answer to "does the campaign cover this + * tag", read by two sides that must agree: + * + * - `components/ProblemBadges.astro` links a covered tag's badge to its + * landing page, and every other tag's badge to `/guides/`; + * - `apps/cli/sync.ts` creates a placeholder `content/guides/.mdx` for + * every tag a problem page carries that is NOT a key here. + * + * Add a key when a campaign topic starts teaching a tag; its guide page is then + * dead weight, delete it by hand. A tag naming two topics (DFS/BFS: tree and + * graph; DP: 1-D and grid) lists both; the badge picks per page. + */ +export const TOPIC_LANDINGS: Record = { + "hash-table": ["/hash-table"], + "prefix-sum": ["/prefix-sum"], + "two-pointers": ["/two-pointers"], + "sliding-window": ["/sliding-window"], + "binary-search": ["/binary-search"], + stack: ["/stack"], + "monotonic-stack": ["/monotonic-stack"], + "linked-list": ["/linked-list"], + matrix: ["/matrix-index-math"], + "depth-first-search": ["/tree-dfs", "/graph-dfs"], + "breadth-first-search": ["/tree-bfs", "/graph-bfs"], + "binary-search-tree": ["/binary-search-tree"], + "heap-priority-queue": ["/heap-priority-queue"], + trie: ["/trie"], + "topological-sort": ["/topological-sort"], + "union-find": ["/union-find"], + backtracking: ["/backtracking"], + "dynamic-programming": ["/1d-dynamic-programming", "/multi-d-grid-dp"], + greedy: ["/greedy"], +};