From 7c5061dcd1210a9d2658e60e156edb0a1a0482b0 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 21 Sep 2026 17:16:10 -0400 Subject: [PATCH] docs(docs): add meta files and reorganize topics with updated badges and directory structure --- apps/docs/content/(array)/meta.ts | 3 + ...3-find-minimum-in-rotated-sorted-array.mdx | 2 +- .../33-search-in-rotated-sorted-array.mdx | 2 +- .../35-search-insert-position.mdx | 2 +- .../704-binary-search.mdx | 2 +- .../74-search-a-2d-matrix.mdx | 2 +- .../875-koko-eating-bananas.mdx | 2 +- apps/docs/content/(binary-search)/meta.ts | 3 + .../230-kth-smallest-element-in-a-bst.mdx | 2 +- ...ommon-ancestor-of-a-binary-search-tree.mdx | 2 +- .../98-validate-binary-search-tree.mdx | 2 +- .../docs/content/(binary-search-tree)/meta.ts | 3 + .../content/(graph-dfs)/133-clone-graph.mdx | 64 +++++++++++++++++++ .../(graph-dfs)/200-number-of-islands.mdx | 51 +++++++++++++++ .../417-pacific-atlantic-water-flow.mdx | 33 ++++++++++ apps/docs/content/(graph-dfs)/meta.ts | 3 + .../{(array) => (hash-table)}/1-two-sum.mdx | 2 +- .../217-contains-duplicate.mdx | 2 +- .../347-top-k-frequent-elements.mdx | 2 +- .../49-group-anagrams.mdx | 2 +- apps/docs/content/(hash-table)/meta.ts | 3 + .../215-kth-largest-element-in-an-array.mdx | 2 +- .../23-merge-k-sorted-lists.mdx | 2 +- .../973-k-closest-points-to-origin.mdx | 2 +- .../content/(heap-priority-queue)/meta.ts | 3 + .../146-lru-cache.mdx | 2 +- .../2-add-two-numbers.mdx | 2 +- apps/docs/content/(hybrid-structures)/meta.ts | 3 + .../141-linked-list-cycle.mdx | 2 +- apps/docs/content/(linked-list)/meta.ts | 3 + .../48-rotate-image.mdx | 2 +- .../54-spiral-matrix.mdx | 2 +- .../73-set-matrix-zeroes.mdx | 2 +- apps/docs/content/(matrix-index-math)/meta.ts | 3 + .../739-daily-temperatures.mdx | 2 +- .../853-car-fleet.mdx | 2 +- apps/docs/content/(monotonic-stack)/meta.ts | 3 + .../238-product-of-array-except-self.mdx | 2 +- .../303-range-sum-query-immutable.mdx | 2 +- .../560-subarray-sum-equals-k.mdx | 2 +- apps/docs/content/(prefix-sum)/meta.ts | 3 + .../121-best-time-to-buy-and-sell-stock.mdx | 2 +- ...substring-without-repeating-characters.mdx | 2 +- ...ongest-repeating-character-replacement.mdx | 2 +- .../567-permutation-in-string.mdx | 2 +- .../index.mdx} | 1 + apps/docs/content/(sliding-window)/meta.ts | 3 + .../150-evaluate-reverse-polish-notation.mdx | 2 +- .../20-valid-parentheses.mdx | 2 +- apps/docs/content/(stack)/meta.ts | 3 + .../102-binary-tree-level-order-traversal.mdx | 2 +- .../1448-count-good-nodes-in-binary-tree.mdx | 2 +- .../199-binary-tree-right-side-view.mdx | 2 +- apps/docs/content/(tree-bfs)/meta.ts | 3 + .../104-maximum-depth-of-binary-tree.mdx | 2 +- .../226-invert-binary-tree.mdx | 2 +- ...owest-common-ancestor-of-a-binary-tree.mdx | 2 +- apps/docs/content/(tree-dfs)/meta.ts | 3 + .../208-implement-trie-prefix-tree.mdx | 2 +- ...gn-add-and-search-words-data-structure.mdx | 4 +- apps/docs/content/(trie)/meta.ts | 3 + .../11-container-with-most-water.mdx | 2 +- .../{(array) => (two-pointers)}/15-3sum.mdx | 2 +- .../167-two-sum-ii-input-array-is-sorted.mdx | 2 +- .../977-squares-of-a-sorted-array.mdx | 2 +- apps/docs/content/(two-pointers)/meta.ts | 3 + 66 files changed, 246 insertions(+), 46 deletions(-) create mode 100644 apps/docs/content/(array)/meta.ts rename apps/docs/content/{(array) => (binary-search)}/153-find-minimum-in-rotated-sorted-array.mdx (97%) rename apps/docs/content/{(array) => (binary-search)}/33-search-in-rotated-sorted-array.mdx (97%) rename apps/docs/content/{(array) => (binary-search)}/35-search-insert-position.mdx (97%) rename apps/docs/content/{(array) => (binary-search)}/704-binary-search.mdx (97%) rename apps/docs/content/{(array) => (binary-search)}/74-search-a-2d-matrix.mdx (98%) rename apps/docs/content/{(array) => (binary-search)}/875-koko-eating-bananas.mdx (97%) create mode 100644 apps/docs/content/(binary-search)/meta.ts rename apps/docs/content/{(tree) => (binary-search-tree)}/230-kth-smallest-element-in-a-bst.mdx (97%) rename apps/docs/content/{(tree) => (binary-search-tree)}/235-lowest-common-ancestor-of-a-binary-search-tree.mdx (97%) rename apps/docs/content/{(tree) => (binary-search-tree)}/98-validate-binary-search-tree.mdx (97%) create mode 100644 apps/docs/content/(binary-search-tree)/meta.ts create mode 100644 apps/docs/content/(graph-dfs)/133-clone-graph.mdx create mode 100644 apps/docs/content/(graph-dfs)/200-number-of-islands.mdx create mode 100644 apps/docs/content/(graph-dfs)/417-pacific-atlantic-water-flow.mdx create mode 100644 apps/docs/content/(graph-dfs)/meta.ts rename apps/docs/content/{(array) => (hash-table)}/1-two-sum.mdx (97%) rename apps/docs/content/{(array) => (hash-table)}/217-contains-duplicate.mdx (97%) rename apps/docs/content/{(array) => (hash-table)}/347-top-k-frequent-elements.mdx (97%) rename apps/docs/content/{(array) => (hash-table)}/49-group-anagrams.mdx (97%) create mode 100644 apps/docs/content/(hash-table)/meta.ts rename apps/docs/content/{(array) => (heap-priority-queue)}/215-kth-largest-element-in-an-array.mdx (96%) rename apps/docs/content/{(linked-list) => (heap-priority-queue)}/23-merge-k-sorted-lists.mdx (97%) rename apps/docs/content/{(array) => (heap-priority-queue)}/973-k-closest-points-to-origin.mdx (97%) create mode 100644 apps/docs/content/(heap-priority-queue)/meta.ts rename apps/docs/content/{(hash-table) => (hybrid-structures)}/146-lru-cache.mdx (98%) rename apps/docs/content/{(linked-list) => (hybrid-structures)}/2-add-two-numbers.mdx (97%) create mode 100644 apps/docs/content/(hybrid-structures)/meta.ts rename apps/docs/content/{(hash-table) => (linked-list)}/141-linked-list-cycle.mdx (97%) create mode 100644 apps/docs/content/(linked-list)/meta.ts rename apps/docs/content/{(array) => (matrix-index-math)}/48-rotate-image.mdx (96%) rename apps/docs/content/{(array) => (matrix-index-math)}/54-spiral-matrix.mdx (97%) rename apps/docs/content/{(array) => (matrix-index-math)}/73-set-matrix-zeroes.mdx (98%) create mode 100644 apps/docs/content/(matrix-index-math)/meta.ts rename apps/docs/content/{(array) => (monotonic-stack)}/739-daily-temperatures.mdx (97%) rename apps/docs/content/{(array) => (monotonic-stack)}/853-car-fleet.mdx (98%) create mode 100644 apps/docs/content/(monotonic-stack)/meta.ts rename apps/docs/content/{(array) => (prefix-sum)}/238-product-of-array-except-self.mdx (97%) rename apps/docs/content/{(array) => (prefix-sum)}/303-range-sum-query-immutable.mdx (97%) rename apps/docs/content/{(array) => (prefix-sum)}/560-subarray-sum-equals-k.mdx (96%) create mode 100644 apps/docs/content/(prefix-sum)/meta.ts rename apps/docs/content/{(array) => (sliding-window)}/121-best-time-to-buy-and-sell-stock.mdx (97%) rename apps/docs/content/{(hash-table) => (sliding-window)}/3-longest-substring-without-repeating-characters.mdx (97%) rename apps/docs/content/{(hash-table) => (sliding-window)}/424-longest-repeating-character-replacement.mdx (97%) rename apps/docs/content/{(hash-table) => (sliding-window)}/567-permutation-in-string.mdx (97%) rename apps/docs/content/{reference/sliding-window.mdx => (sliding-window)/index.mdx} (99%) create mode 100644 apps/docs/content/(sliding-window)/meta.ts rename apps/docs/content/{(array) => (stack)}/150-evaluate-reverse-polish-notation.mdx (98%) rename apps/docs/content/{(string) => (stack)}/20-valid-parentheses.mdx (97%) create mode 100644 apps/docs/content/(stack)/meta.ts rename apps/docs/content/{(tree) => (tree-bfs)}/102-binary-tree-level-order-traversal.mdx (98%) rename apps/docs/content/{(tree) => (tree-bfs)}/1448-count-good-nodes-in-binary-tree.mdx (98%) rename apps/docs/content/{(tree) => (tree-bfs)}/199-binary-tree-right-side-view.mdx (98%) create mode 100644 apps/docs/content/(tree-bfs)/meta.ts rename apps/docs/content/{(tree) => (tree-dfs)}/104-maximum-depth-of-binary-tree.mdx (96%) rename apps/docs/content/{(tree) => (tree-dfs)}/226-invert-binary-tree.mdx (97%) rename apps/docs/content/{(tree) => (tree-dfs)}/236-lowest-common-ancestor-of-a-binary-tree.mdx (98%) create mode 100644 apps/docs/content/(tree-dfs)/meta.ts rename apps/docs/content/{(hash-table) => (trie)}/208-implement-trie-prefix-tree.mdx (98%) rename apps/docs/content/{(string) => (trie)}/211-design-add-and-search-words-data-structure.mdx (97%) create mode 100644 apps/docs/content/(trie)/meta.ts rename apps/docs/content/{(array) => (two-pointers)}/11-container-with-most-water.mdx (97%) rename apps/docs/content/{(array) => (two-pointers)}/15-3sum.mdx (98%) rename apps/docs/content/{(array) => (two-pointers)}/167-two-sum-ii-input-array-is-sorted.mdx (97%) rename apps/docs/content/{(array) => (two-pointers)}/977-squares-of-a-sorted-array.mdx (97%) create mode 100644 apps/docs/content/(two-pointers)/meta.ts diff --git a/apps/docs/content/(array)/meta.ts b/apps/docs/content/(array)/meta.ts new file mode 100644 index 0000000..29af647 --- /dev/null +++ b/apps/docs/content/(array)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Array" }); diff --git a/apps/docs/content/(array)/153-find-minimum-in-rotated-sorted-array.mdx b/apps/docs/content/(binary-search)/153-find-minimum-in-rotated-sorted-array.mdx similarity index 97% rename from apps/docs/content/(array)/153-find-minimum-in-rotated-sorted-array.mdx rename to apps/docs/content/(binary-search)/153-find-minimum-in-rotated-sorted-array.mdx index f285bb5..f3b168d 100644 --- a/apps/docs/content/(array)/153-find-minimum-in-rotated-sorted-array.mdx +++ b/apps/docs/content/(binary-search)/153-find-minimum-in-rotated-sorted-array.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search +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]]. diff --git a/apps/docs/content/(array)/33-search-in-rotated-sorted-array.mdx b/apps/docs/content/(binary-search)/33-search-in-rotated-sorted-array.mdx similarity index 97% rename from apps/docs/content/(array)/33-search-in-rotated-sorted-array.mdx rename to apps/docs/content/(binary-search)/33-search-in-rotated-sorted-array.mdx index 81515a0..482cae6 100644 --- a/apps/docs/content/(array)/33-search-in-rotated-sorted-array.mdx +++ b/apps/docs/content/(binary-search)/33-search-in-rotated-sorted-array.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search +Array ::::warning You must write an algorithm with O(log n) runtime complexity. diff --git a/apps/docs/content/(array)/35-search-insert-position.mdx b/apps/docs/content/(binary-search)/35-search-insert-position.mdx similarity index 97% rename from apps/docs/content/(array)/35-search-insert-position.mdx rename to apps/docs/content/(binary-search)/35-search-insert-position.mdx index ed458c2..7bf389d 100644 --- a/apps/docs/content/(array)/35-search-insert-position.mdx +++ b/apps/docs/content/(binary-search)/35-search-insert-position.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Binary Search +Array ::::warning You must write an algorithm with O(log n) runtime complexity. diff --git a/apps/docs/content/(array)/704-binary-search.mdx b/apps/docs/content/(binary-search)/704-binary-search.mdx similarity index 97% rename from apps/docs/content/(array)/704-binary-search.mdx rename to apps/docs/content/(binary-search)/704-binary-search.mdx index 513d1c7..5f21899 100644 --- a/apps/docs/content/(array)/704-binary-search.mdx +++ b/apps/docs/content/(binary-search)/704-binary-search.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Binary Search +Array ::::warning You must write an algorithm with O(log n) runtime complexity. diff --git a/apps/docs/content/(array)/74-search-a-2d-matrix.mdx b/apps/docs/content/(binary-search)/74-search-a-2d-matrix.mdx similarity index 98% rename from apps/docs/content/(array)/74-search-a-2d-matrix.mdx rename to apps/docs/content/(binary-search)/74-search-a-2d-matrix.mdx index d53794c..1c501ba 100644 --- a/apps/docs/content/(array)/74-search-a-2d-matrix.mdx +++ b/apps/docs/content/(binary-search)/74-search-a-2d-matrix.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search +Array ::::warning You must write a solution in O(log(m * n)) time complexity. diff --git a/apps/docs/content/(array)/875-koko-eating-bananas.mdx b/apps/docs/content/(binary-search)/875-koko-eating-bananas.mdx similarity index 97% rename from apps/docs/content/(array)/875-koko-eating-bananas.mdx rename to apps/docs/content/(binary-search)/875-koko-eating-bananas.mdx index 721f566..a8a28b4 100644 --- a/apps/docs/content/(array)/875-koko-eating-bananas.mdx +++ b/apps/docs/content/(binary-search)/875-koko-eating-bananas.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search +Array ### Example 1: - Input: `piles = [3,6,7,11], h = 8` diff --git a/apps/docs/content/(binary-search)/meta.ts b/apps/docs/content/(binary-search)/meta.ts new file mode 100644 index 0000000..1b30de2 --- /dev/null +++ b/apps/docs/content/(binary-search)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Binary Search", order: 5 }); diff --git a/apps/docs/content/(tree)/230-kth-smallest-element-in-a-bst.mdx b/apps/docs/content/(binary-search-tree)/230-kth-smallest-element-in-a-bst.mdx similarity index 97% rename from apps/docs/content/(tree)/230-kth-smallest-element-in-a-bst.mdx rename to apps/docs/content/(binary-search-tree)/230-kth-smallest-element-in-a-bst.mdx index e71f5dc..3cbb5ef 100644 --- a/apps/docs/content/(tree)/230-kth-smallest-element-in-a-bst.mdx +++ b/apps/docs/content/(binary-search-tree)/230-kth-smallest-element-in-a-bst.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search Tree +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? diff --git a/apps/docs/content/(tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx b/apps/docs/content/(binary-search-tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx similarity index 97% rename from apps/docs/content/(tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx rename to apps/docs/content/(binary-search-tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx index 16b194e..f1a8e60 100644 --- a/apps/docs/content/(tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx +++ b/apps/docs/content/(binary-search-tree)/235-lowest-common-ancestor-of-a-binary-search-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search Tree +Tree ### Example 1: - Input: `root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 8` diff --git a/apps/docs/content/(tree)/98-validate-binary-search-tree.mdx b/apps/docs/content/(binary-search-tree)/98-validate-binary-search-tree.mdx similarity index 97% rename from apps/docs/content/(tree)/98-validate-binary-search-tree.mdx rename to apps/docs/content/(binary-search-tree)/98-validate-binary-search-tree.mdx index b96b0d9..b642531 100644 --- a/apps/docs/content/(tree)/98-validate-binary-search-tree.mdx +++ b/apps/docs/content/(binary-search-tree)/98-validate-binary-search-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Binary Search Tree +Tree ### Example 1: - Input: `root = [2,1,3]` diff --git a/apps/docs/content/(binary-search-tree)/meta.ts b/apps/docs/content/(binary-search-tree)/meta.ts new file mode 100644 index 0000000..00754ea --- /dev/null +++ b/apps/docs/content/(binary-search-tree)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Binary Search Tree", order: 13 }); diff --git a/apps/docs/content/(graph-dfs)/133-clone-graph.mdx b/apps/docs/content/(graph-dfs)/133-clone-graph.mdx new file mode 100644 index 0000000..ecc91b5 --- /dev/null +++ b/apps/docs/content/(graph-dfs)/133-clone-graph.mdx @@ -0,0 +1,64 @@ +--- +title: '133. Clone Graph' +description: Given a reference of a node in a connected undirected 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]]` +- Explanation: There are `4` nodes in the graph. 1st `node` (val = 1)'s neighbors are 2nd `node` (val = `2`) and 4th `node` (val = `4`). 2nd `node` (val = 2)'s neighbors are 1st `node` (val = `1`) and 3rd `node` (val = `3`). 3rd `node` (val = 3)'s neighbors are 2nd `node` (val = `2`) and 4th `node` (val = `4`). 4th `node` (val = 4)'s neighbors are 1st `node` (val = `1`) and 3rd `node` (val = `3`). + +### Example 2: +- Input: `adjList = [[]]` +- Output: `[[]]` +- Explanation: Note that the input contains one empty list. The graph consists of only one `node` with val = `1` and it does not have any neighbors. + +### Example 3: +- Input: `adjList = []` +- Output: `[]` +- Explanation: This an empty graph, it does not have any nodes. + +### Constraints: + +- The number of nodes in the graph is in the range [0, 100]. +- `1 <= Node.val <= 100` +- Node.val is unique for each node. +- There are no repeated edges and no self-loops in the graph. +- The Graph is connected and all nodes can be visited starting from the given node. + +## Solution + +```py +""" +# Definition for a Node. +class Node: + def __init__(self, val = 0, neighbors = None): + self.val = val + self.neighbors = neighbors if neighbors is not None else [] +""" + +from typing import Optional + + +class Solution: + def cloneGraph(self, node: Optional["Node"]) -> Optional["Node"]: + oldToNew = {} + + def dfs(node): + if node in oldToNew: + return oldToNew[node] + + copy = Node(node.val) + oldToNew[node] = copy + + for n in node.neighbors: + copy.neighbors.append(dfs(n)) + return copy + + return dfs(node) if node else None +``` diff --git a/apps/docs/content/(graph-dfs)/200-number-of-islands.mdx b/apps/docs/content/(graph-dfs)/200-number-of-islands.mdx new file mode 100644 index 0000000..86f5108 --- /dev/null +++ b/apps/docs/content/(graph-dfs)/200-number-of-islands.mdx @@ -0,0 +1,51 @@ +--- +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 +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` + +### Example 2: +- Input: `grid = [ ["1","1","0","0","0"], ["1","1","0","0","0"], ["0","0","1","0","0"], ["0","0","0","1","1"] ]` +- Output: `3` + +### Constraints: + +- `m == grid.length` +- `n == grid[i].length` +- `1 <= m, n <= 300` +- grid[i][j] is '0' or '1'. + +## Solution + +```py +class Solution: + def numIslands(self, grid: List[List[str]]) -> int: + rows, cols = len(grid), len(grid[0]) + + def dfs(r, c): + if r < 0 or r >= rows or c < 0 or c >= cols or grid[r][c] != "1": + return + else: + grid[r][c] = "0" + dfs(r, c + 1) # right + dfs(r + 1, c) # bottom + dfs(r, c - 1) # left + dfs(r - 1, c) # top + + num_islands = 0 + for r in range(rows): + for c in range(cols): + if grid[r][c] == "1": + num_islands += 1 + dfs(r, c) + + return num_islands +``` diff --git a/apps/docs/content/(graph-dfs)/417-pacific-atlantic-water-flow.mdx b/apps/docs/content/(graph-dfs)/417-pacific-atlantic-water-flow.mdx new file mode 100644 index 0000000..e5e894c --- /dev/null +++ b/apps/docs/content/(graph-dfs)/417-pacific-atlantic-water-flow.mdx @@ -0,0 +1,33 @@ +--- +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 +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]]` +- Explanation: The following cells can flow to the Pacific and Atlantic oceans, as shown below: `[0,4]`: `[0,4]` -> Pacific Ocean `[0,4]` -> Atlantic Ocean `[1,3]`: `[1,3]` -> `[0,3]` -> Pacific Ocean `[1,3]` -> `[1,4]` -> Atlantic Ocean `[1,4]`: `[1,4]` -> `[1,3]` -> `[0,3]` -> Pacific Ocean `[1,4]` -> Atlantic Ocean `[2,2]`: `[2,2]` -> `[1,2]` -> `[0,2]` -> Pacific Ocean `[2,2]` -> `[2,3]` -> `[2,4]` -> Atlantic Ocean `[3,0]`: `[3,0]` -> Pacific Ocean `[3,0]` -> `[4,0]` -> Atlantic Ocean `[3,1]`: `[3,1]` -> `[3,0]` -> Pacific Ocean `[3,1]` -> `[4,1]` -> Atlantic Ocean `[4,0]`: `[4,0]` -> Pacific Ocean `[4,0]` -> Atlantic Ocean Note that there are other possible paths for these cells to flow to the Pacific and Atlantic oceans. + +### Example 2: +- Input: `heights = [[1]]` +- Output: `[[0,0]]` +- Explanation: The water can flow from the only cell to the Pacific and Atlantic oceans. + +### Constraints: + +- `m == heights.length` +- `n == heights[r].length` +- `1 <= m, n <= 200` +- `0 <= heights[r][c] <= 10^5` + +## Solution + +```py +class Solution: + def pacificAtlantic(self, heights: list[list[int]]) -> list[list[int]]: +``` diff --git a/apps/docs/content/(graph-dfs)/meta.ts b/apps/docs/content/(graph-dfs)/meta.ts new file mode 100644 index 0000000..f913023 --- /dev/null +++ b/apps/docs/content/(graph-dfs)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Graph DFS", order: 16 }); diff --git a/apps/docs/content/(array)/1-two-sum.mdx b/apps/docs/content/(hash-table)/1-two-sum.mdx similarity index 97% rename from apps/docs/content/(array)/1-two-sum.mdx rename to apps/docs/content/(hash-table)/1-two-sum.mdx index 20bded5..5198b44 100644 --- a/apps/docs/content/(array)/1-two-sum.mdx +++ b/apps/docs/content/(hash-table)/1-two-sum.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Hash Table +Array ::::warning Can you come up with an algorithm that is less than O(n^2) time complexity? diff --git a/apps/docs/content/(array)/217-contains-duplicate.mdx b/apps/docs/content/(hash-table)/217-contains-duplicate.mdx similarity index 97% rename from apps/docs/content/(array)/217-contains-duplicate.mdx rename to apps/docs/content/(hash-table)/217-contains-duplicate.mdx index 2dd53ac..15d9e0b 100644 --- a/apps/docs/content/(array)/217-contains-duplicate.mdx +++ b/apps/docs/content/(hash-table)/217-contains-duplicate.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Hash Table +Array ### Example 1: - Input: `nums = [1,2,3,1]` diff --git a/apps/docs/content/(array)/347-top-k-frequent-elements.mdx b/apps/docs/content/(hash-table)/347-top-k-frequent-elements.mdx similarity index 97% rename from apps/docs/content/(array)/347-top-k-frequent-elements.mdx rename to apps/docs/content/(hash-table)/347-top-k-frequent-elements.mdx index bf9b30c..850fbce 100644 --- a/apps/docs/content/(array)/347-top-k-frequent-elements.mdx +++ b/apps/docs/content/(hash-table)/347-top-k-frequent-elements.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Hash Table +Array ::::warning Your algorithm's time complexity must be better than O(n log n), where n is the array's size. diff --git a/apps/docs/content/(array)/49-group-anagrams.mdx b/apps/docs/content/(hash-table)/49-group-anagrams.mdx similarity index 97% rename from apps/docs/content/(array)/49-group-anagrams.mdx rename to apps/docs/content/(hash-table)/49-group-anagrams.mdx index a6730ca..57fbdab 100644 --- a/apps/docs/content/(array)/49-group-anagrams.mdx +++ b/apps/docs/content/(hash-table)/49-group-anagrams.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Hash Table +Array ### Example 1: - Input: `strs = ["eat","tea","tan","ate","nat","bat"]` diff --git a/apps/docs/content/(hash-table)/meta.ts b/apps/docs/content/(hash-table)/meta.ts new file mode 100644 index 0000000..40e947d --- /dev/null +++ b/apps/docs/content/(hash-table)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Hash Table", order: 1 }); diff --git a/apps/docs/content/(array)/215-kth-largest-element-in-an-array.mdx b/apps/docs/content/(heap-priority-queue)/215-kth-largest-element-in-an-array.mdx similarity index 96% rename from apps/docs/content/(array)/215-kth-largest-element-in-an-array.mdx rename to apps/docs/content/(heap-priority-queue)/215-kth-largest-element-in-an-array.mdx index 479bb5d..5ae734d 100644 --- a/apps/docs/content/(array)/215-kth-largest-element-in-an-array.mdx +++ b/apps/docs/content/(heap-priority-queue)/215-kth-largest-element-in-an-array.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Heap / Priority Queue +Array ### Example 1: - Input: `nums = [3,2,1,5,6,4], k = 2` diff --git a/apps/docs/content/(linked-list)/23-merge-k-sorted-lists.mdx b/apps/docs/content/(heap-priority-queue)/23-merge-k-sorted-lists.mdx similarity index 97% rename from apps/docs/content/(linked-list)/23-merge-k-sorted-lists.mdx rename to apps/docs/content/(heap-priority-queue)/23-merge-k-sorted-lists.mdx index 7c78d3e..544b8f6 100644 --- a/apps/docs/content/(linked-list)/23-merge-k-sorted-lists.mdx +++ b/apps/docs/content/(heap-priority-queue)/23-merge-k-sorted-lists.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Hard' --- -Heap / Priority Queue +Linked List ### Example 1: - Input: `lists = [[1,4,5],[1,3,4],[2,6]]` diff --git a/apps/docs/content/(array)/973-k-closest-points-to-origin.mdx b/apps/docs/content/(heap-priority-queue)/973-k-closest-points-to-origin.mdx similarity index 97% rename from apps/docs/content/(array)/973-k-closest-points-to-origin.mdx rename to apps/docs/content/(heap-priority-queue)/973-k-closest-points-to-origin.mdx index 97e767d..236950b 100644 --- a/apps/docs/content/(array)/973-k-closest-points-to-origin.mdx +++ b/apps/docs/content/(heap-priority-queue)/973-k-closest-points-to-origin.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Heap / Priority Queue +Array ### Example 1: - Input: `points = [[1,3],[-2,2]], k = 1` diff --git a/apps/docs/content/(heap-priority-queue)/meta.ts b/apps/docs/content/(heap-priority-queue)/meta.ts new file mode 100644 index 0000000..eb89200 --- /dev/null +++ b/apps/docs/content/(heap-priority-queue)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Heap", order: 14 }); diff --git a/apps/docs/content/(hash-table)/146-lru-cache.mdx b/apps/docs/content/(hybrid-structures)/146-lru-cache.mdx similarity index 98% rename from apps/docs/content/(hash-table)/146-lru-cache.mdx rename to apps/docs/content/(hybrid-structures)/146-lru-cache.mdx index 53f4791..c00c6a7 100644 --- a/apps/docs/content/(hash-table)/146-lru-cache.mdx +++ b/apps/docs/content/(hybrid-structures)/146-lru-cache.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Hybrid Structures +Hash Table ### Example 1: - Input: `` diff --git a/apps/docs/content/(linked-list)/2-add-two-numbers.mdx b/apps/docs/content/(hybrid-structures)/2-add-two-numbers.mdx similarity index 97% rename from apps/docs/content/(linked-list)/2-add-two-numbers.mdx rename to apps/docs/content/(hybrid-structures)/2-add-two-numbers.mdx index abe7fa1..114362e 100644 --- a/apps/docs/content/(linked-list)/2-add-two-numbers.mdx +++ b/apps/docs/content/(hybrid-structures)/2-add-two-numbers.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Hybrid Structures +Linked List ### Example 1: - Input: `l1 = [2,4,3], l2 = [5,6,4]` diff --git a/apps/docs/content/(hybrid-structures)/meta.ts b/apps/docs/content/(hybrid-structures)/meta.ts new file mode 100644 index 0000000..dc46add --- /dev/null +++ b/apps/docs/content/(hybrid-structures)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Hybrid Structures", order: 9 }); diff --git a/apps/docs/content/(hash-table)/141-linked-list-cycle.mdx b/apps/docs/content/(linked-list)/141-linked-list-cycle.mdx similarity index 97% rename from apps/docs/content/(hash-table)/141-linked-list-cycle.mdx rename to apps/docs/content/(linked-list)/141-linked-list-cycle.mdx index f1413d9..0c06112 100644 --- a/apps/docs/content/(hash-table)/141-linked-list-cycle.mdx +++ b/apps/docs/content/(linked-list)/141-linked-list-cycle.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Linked List +Hash Table ::::warning Can you solve it using O(1) (i.e. constant) memory? diff --git a/apps/docs/content/(linked-list)/meta.ts b/apps/docs/content/(linked-list)/meta.ts new file mode 100644 index 0000000..1452fab --- /dev/null +++ b/apps/docs/content/(linked-list)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Linked List", order: 8 }); diff --git a/apps/docs/content/(array)/48-rotate-image.mdx b/apps/docs/content/(matrix-index-math)/48-rotate-image.mdx similarity index 96% rename from apps/docs/content/(array)/48-rotate-image.mdx rename to apps/docs/content/(matrix-index-math)/48-rotate-image.mdx index a671b84..1abdb30 100644 --- a/apps/docs/content/(array)/48-rotate-image.mdx +++ b/apps/docs/content/(matrix-index-math)/48-rotate-image.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Matrix Index Math +Array ### Example 1: - Input: `matrix = [[1,2,3],[4,5,6],[7,8,9]]` diff --git a/apps/docs/content/(array)/54-spiral-matrix.mdx b/apps/docs/content/(matrix-index-math)/54-spiral-matrix.mdx similarity index 97% rename from apps/docs/content/(array)/54-spiral-matrix.mdx rename to apps/docs/content/(matrix-index-math)/54-spiral-matrix.mdx index a783f61..cc2dd97 100644 --- a/apps/docs/content/(array)/54-spiral-matrix.mdx +++ b/apps/docs/content/(matrix-index-math)/54-spiral-matrix.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Matrix Index Math +Array ### Example 1: - Input: `matrix = [[1,2,3],[4,5,6],[7,8,9]]` diff --git a/apps/docs/content/(array)/73-set-matrix-zeroes.mdx b/apps/docs/content/(matrix-index-math)/73-set-matrix-zeroes.mdx similarity index 98% rename from apps/docs/content/(array)/73-set-matrix-zeroes.mdx rename to apps/docs/content/(matrix-index-math)/73-set-matrix-zeroes.mdx index 37f9e8b..f603da9 100644 --- a/apps/docs/content/(array)/73-set-matrix-zeroes.mdx +++ b/apps/docs/content/(matrix-index-math)/73-set-matrix-zeroes.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Matrix Index Math +Array ::::warning You must do it in place. diff --git a/apps/docs/content/(matrix-index-math)/meta.ts b/apps/docs/content/(matrix-index-math)/meta.ts new file mode 100644 index 0000000..9dc74fe --- /dev/null +++ b/apps/docs/content/(matrix-index-math)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Matrix Index Math", order: 10 }); diff --git a/apps/docs/content/(array)/739-daily-temperatures.mdx b/apps/docs/content/(monotonic-stack)/739-daily-temperatures.mdx similarity index 97% rename from apps/docs/content/(array)/739-daily-temperatures.mdx rename to apps/docs/content/(monotonic-stack)/739-daily-temperatures.mdx index 2b8e63a..ff48d70 100644 --- a/apps/docs/content/(array)/739-daily-temperatures.mdx +++ b/apps/docs/content/(monotonic-stack)/739-daily-temperatures.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Monotonic Stack +Array ### Example 1: - Input: `temperatures = [73,74,75,71,69,72,76,73]` diff --git a/apps/docs/content/(array)/853-car-fleet.mdx b/apps/docs/content/(monotonic-stack)/853-car-fleet.mdx similarity index 98% rename from apps/docs/content/(array)/853-car-fleet.mdx rename to apps/docs/content/(monotonic-stack)/853-car-fleet.mdx index 89068d1..1d91099 100644 --- a/apps/docs/content/(array)/853-car-fleet.mdx +++ b/apps/docs/content/(monotonic-stack)/853-car-fleet.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Monotonic Stack +Array ### Example 1: - Input: `target = 12, position = [10,8,0,5,3], speed = [2,4,1,1,3]` diff --git a/apps/docs/content/(monotonic-stack)/meta.ts b/apps/docs/content/(monotonic-stack)/meta.ts new file mode 100644 index 0000000..2fb40c5 --- /dev/null +++ b/apps/docs/content/(monotonic-stack)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Monotonic Stack", order: 7 }); diff --git a/apps/docs/content/(array)/238-product-of-array-except-self.mdx b/apps/docs/content/(prefix-sum)/238-product-of-array-except-self.mdx similarity index 97% rename from apps/docs/content/(array)/238-product-of-array-except-self.mdx rename to apps/docs/content/(prefix-sum)/238-product-of-array-except-self.mdx index 3e622d3..5f0f470 100644 --- a/apps/docs/content/(array)/238-product-of-array-except-self.mdx +++ b/apps/docs/content/(prefix-sum)/238-product-of-array-except-self.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Prefix Sum +Array ::::warning You must write an algorithm that runs in O(n) time and without using the division operation. diff --git a/apps/docs/content/(array)/303-range-sum-query-immutable.mdx b/apps/docs/content/(prefix-sum)/303-range-sum-query-immutable.mdx similarity index 97% rename from apps/docs/content/(array)/303-range-sum-query-immutable.mdx rename to apps/docs/content/(prefix-sum)/303-range-sum-query-immutable.mdx index 821498f..98ab3c5 100644 --- a/apps/docs/content/(array)/303-range-sum-query-immutable.mdx +++ b/apps/docs/content/(prefix-sum)/303-range-sum-query-immutable.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Prefix Sum +Array ### Example 1: - Input: `["NumArray", "sumRange", "sumRange", "sumRange"]` `[[[-2, 0, 3, -5, 2, -1]], [0, 2], [2, 5], [0, 5]]` diff --git a/apps/docs/content/(array)/560-subarray-sum-equals-k.mdx b/apps/docs/content/(prefix-sum)/560-subarray-sum-equals-k.mdx similarity index 96% rename from apps/docs/content/(array)/560-subarray-sum-equals-k.mdx rename to apps/docs/content/(prefix-sum)/560-subarray-sum-equals-k.mdx index 5e67546..cfe4913 100644 --- a/apps/docs/content/(array)/560-subarray-sum-equals-k.mdx +++ b/apps/docs/content/(prefix-sum)/560-subarray-sum-equals-k.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Prefix Sum +Array ### Example 1: - Input: `nums = [1,1,1], k = 2` diff --git a/apps/docs/content/(prefix-sum)/meta.ts b/apps/docs/content/(prefix-sum)/meta.ts new file mode 100644 index 0000000..cd6eb30 --- /dev/null +++ b/apps/docs/content/(prefix-sum)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Prefix Sum", order: 2 }); diff --git a/apps/docs/content/(array)/121-best-time-to-buy-and-sell-stock.mdx b/apps/docs/content/(sliding-window)/121-best-time-to-buy-and-sell-stock.mdx similarity index 97% rename from apps/docs/content/(array)/121-best-time-to-buy-and-sell-stock.mdx rename to apps/docs/content/(sliding-window)/121-best-time-to-buy-and-sell-stock.mdx index 75c980c..77f4c13 100644 --- a/apps/docs/content/(array)/121-best-time-to-buy-and-sell-stock.mdx +++ b/apps/docs/content/(sliding-window)/121-best-time-to-buy-and-sell-stock.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Sliding Window +Array ### Example 1: - Input: `prices = [7,1,5,3,6,4]` diff --git a/apps/docs/content/(hash-table)/3-longest-substring-without-repeating-characters.mdx b/apps/docs/content/(sliding-window)/3-longest-substring-without-repeating-characters.mdx similarity index 97% rename from apps/docs/content/(hash-table)/3-longest-substring-without-repeating-characters.mdx rename to apps/docs/content/(sliding-window)/3-longest-substring-without-repeating-characters.mdx index 72d73d2..8d4649e 100644 --- a/apps/docs/content/(hash-table)/3-longest-substring-without-repeating-characters.mdx +++ b/apps/docs/content/(sliding-window)/3-longest-substring-without-repeating-characters.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Sliding Window +Hash Table ### Example 1: - Input: `s = "abcabcbb"` diff --git a/apps/docs/content/(hash-table)/424-longest-repeating-character-replacement.mdx b/apps/docs/content/(sliding-window)/424-longest-repeating-character-replacement.mdx similarity index 97% rename from apps/docs/content/(hash-table)/424-longest-repeating-character-replacement.mdx rename to apps/docs/content/(sliding-window)/424-longest-repeating-character-replacement.mdx index f4deb7d..11af1e8 100644 --- a/apps/docs/content/(hash-table)/424-longest-repeating-character-replacement.mdx +++ b/apps/docs/content/(sliding-window)/424-longest-repeating-character-replacement.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Sliding Window +Hash Table ### Example 1: - Input: `s = "ABAB", k = 2` diff --git a/apps/docs/content/(hash-table)/567-permutation-in-string.mdx b/apps/docs/content/(sliding-window)/567-permutation-in-string.mdx similarity index 97% rename from apps/docs/content/(hash-table)/567-permutation-in-string.mdx rename to apps/docs/content/(sliding-window)/567-permutation-in-string.mdx index f5e4734..0e5aad0 100644 --- a/apps/docs/content/(hash-table)/567-permutation-in-string.mdx +++ b/apps/docs/content/(sliding-window)/567-permutation-in-string.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Sliding Window +Hash Table ### Example 1: - Input: `s1 = "ab", s2 = "eidbaooo"` diff --git a/apps/docs/content/reference/sliding-window.mdx b/apps/docs/content/(sliding-window)/index.mdx similarity index 99% rename from apps/docs/content/reference/sliding-window.mdx rename to apps/docs/content/(sliding-window)/index.mdx index 8b6285d..0d9c04a 100644 --- a/apps/docs/content/reference/sliding-window.mdx +++ b/apps/docs/content/(sliding-window)/index.mdx @@ -1,6 +1,7 @@ --- title: Sliding Window description: 'Sliding window is a specialized two-pointer family where the pointers define a contiguous interval and you maintain information about that entire interval as it moves.' +hidden: true --- :::warning diff --git a/apps/docs/content/(sliding-window)/meta.ts b/apps/docs/content/(sliding-window)/meta.ts new file mode 100644 index 0000000..80c4f23 --- /dev/null +++ b/apps/docs/content/(sliding-window)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Sliding Window", order: 4 }); diff --git a/apps/docs/content/(array)/150-evaluate-reverse-polish-notation.mdx b/apps/docs/content/(stack)/150-evaluate-reverse-polish-notation.mdx similarity index 98% rename from apps/docs/content/(array)/150-evaluate-reverse-polish-notation.mdx rename to apps/docs/content/(stack)/150-evaluate-reverse-polish-notation.mdx index 42eb2ec..d2b3680 100644 --- a/apps/docs/content/(array)/150-evaluate-reverse-polish-notation.mdx +++ b/apps/docs/content/(stack)/150-evaluate-reverse-polish-notation.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Stack +Array ### Example 1: - Input: `tokens = ["2","1","+","3","*"]` diff --git a/apps/docs/content/(string)/20-valid-parentheses.mdx b/apps/docs/content/(stack)/20-valid-parentheses.mdx similarity index 97% rename from apps/docs/content/(string)/20-valid-parentheses.mdx rename to apps/docs/content/(stack)/20-valid-parentheses.mdx index d67f136..1c9d35d 100644 --- a/apps/docs/content/(string)/20-valid-parentheses.mdx +++ b/apps/docs/content/(stack)/20-valid-parentheses.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Stack +String ### Example 1: - Input: `s = "()"` diff --git a/apps/docs/content/(stack)/meta.ts b/apps/docs/content/(stack)/meta.ts new file mode 100644 index 0000000..c1ae1fd --- /dev/null +++ b/apps/docs/content/(stack)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Stack", order: 6 }); diff --git a/apps/docs/content/(tree)/102-binary-tree-level-order-traversal.mdx b/apps/docs/content/(tree-bfs)/102-binary-tree-level-order-traversal.mdx similarity index 98% rename from apps/docs/content/(tree)/102-binary-tree-level-order-traversal.mdx rename to apps/docs/content/(tree-bfs)/102-binary-tree-level-order-traversal.mdx index 590d732..f37dc51 100644 --- a/apps/docs/content/(tree)/102-binary-tree-level-order-traversal.mdx +++ b/apps/docs/content/(tree-bfs)/102-binary-tree-level-order-traversal.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Tree BFS +Tree ### Example 1: - Input: `root = [3,9,20,null,null,15,7]` diff --git a/apps/docs/content/(tree)/1448-count-good-nodes-in-binary-tree.mdx b/apps/docs/content/(tree-bfs)/1448-count-good-nodes-in-binary-tree.mdx similarity index 98% rename from apps/docs/content/(tree)/1448-count-good-nodes-in-binary-tree.mdx rename to apps/docs/content/(tree-bfs)/1448-count-good-nodes-in-binary-tree.mdx index 5343e70..ba3beee 100644 --- a/apps/docs/content/(tree)/1448-count-good-nodes-in-binary-tree.mdx +++ b/apps/docs/content/(tree-bfs)/1448-count-good-nodes-in-binary-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Tree BFS +Tree ### Example 1: - Input: `root = [3,1,4,3,null,1,5]` diff --git a/apps/docs/content/(tree)/199-binary-tree-right-side-view.mdx b/apps/docs/content/(tree-bfs)/199-binary-tree-right-side-view.mdx similarity index 98% rename from apps/docs/content/(tree)/199-binary-tree-right-side-view.mdx rename to apps/docs/content/(tree-bfs)/199-binary-tree-right-side-view.mdx index bf191b2..5bf8686 100644 --- a/apps/docs/content/(tree)/199-binary-tree-right-side-view.mdx +++ b/apps/docs/content/(tree-bfs)/199-binary-tree-right-side-view.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Tree BFS +Tree ### Example 1: - Input: `root = [1,2,3,null,5,null,4]` diff --git a/apps/docs/content/(tree-bfs)/meta.ts b/apps/docs/content/(tree-bfs)/meta.ts new file mode 100644 index 0000000..dc9c530 --- /dev/null +++ b/apps/docs/content/(tree-bfs)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Tree BFS", order: 12 }); diff --git a/apps/docs/content/(tree)/104-maximum-depth-of-binary-tree.mdx b/apps/docs/content/(tree-dfs)/104-maximum-depth-of-binary-tree.mdx similarity index 96% rename from apps/docs/content/(tree)/104-maximum-depth-of-binary-tree.mdx rename to apps/docs/content/(tree-dfs)/104-maximum-depth-of-binary-tree.mdx index b417349..7eead8a 100644 --- a/apps/docs/content/(tree)/104-maximum-depth-of-binary-tree.mdx +++ b/apps/docs/content/(tree-dfs)/104-maximum-depth-of-binary-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Tree DFS +Tree ### Example 1: - Input: `root = [3,9,20,null,null,15,7]` diff --git a/apps/docs/content/(tree)/226-invert-binary-tree.mdx b/apps/docs/content/(tree-dfs)/226-invert-binary-tree.mdx similarity index 97% rename from apps/docs/content/(tree)/226-invert-binary-tree.mdx rename to apps/docs/content/(tree-dfs)/226-invert-binary-tree.mdx index 9f3bc89..e14f4de 100644 --- a/apps/docs/content/(tree)/226-invert-binary-tree.mdx +++ b/apps/docs/content/(tree-dfs)/226-invert-binary-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Tree DFS +Tree ### Example 1: - Input: `root = [4,2,7,1,3,6,9]` diff --git a/apps/docs/content/(tree)/236-lowest-common-ancestor-of-a-binary-tree.mdx b/apps/docs/content/(tree-dfs)/236-lowest-common-ancestor-of-a-binary-tree.mdx similarity index 98% rename from apps/docs/content/(tree)/236-lowest-common-ancestor-of-a-binary-tree.mdx rename to apps/docs/content/(tree-dfs)/236-lowest-common-ancestor-of-a-binary-tree.mdx index 24c7ce2..c543192 100644 --- a/apps/docs/content/(tree)/236-lowest-common-ancestor-of-a-binary-tree.mdx +++ b/apps/docs/content/(tree-dfs)/236-lowest-common-ancestor-of-a-binary-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Tree DFS +Tree ### Example 1: - Input: `root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1` diff --git a/apps/docs/content/(tree-dfs)/meta.ts b/apps/docs/content/(tree-dfs)/meta.ts new file mode 100644 index 0000000..886e861 --- /dev/null +++ b/apps/docs/content/(tree-dfs)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Tree DFS", order: 11 }); diff --git a/apps/docs/content/(hash-table)/208-implement-trie-prefix-tree.mdx b/apps/docs/content/(trie)/208-implement-trie-prefix-tree.mdx similarity index 98% rename from apps/docs/content/(hash-table)/208-implement-trie-prefix-tree.mdx rename to apps/docs/content/(trie)/208-implement-trie-prefix-tree.mdx index 8914746..db5294a 100644 --- a/apps/docs/content/(hash-table)/208-implement-trie-prefix-tree.mdx +++ b/apps/docs/content/(trie)/208-implement-trie-prefix-tree.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Trie +Hash Table ### Example 1: - Input: `` diff --git a/apps/docs/content/(string)/211-design-add-and-search-words-data-structure.mdx b/apps/docs/content/(trie)/211-design-add-and-search-words-data-structure.mdx similarity index 97% rename from apps/docs/content/(string)/211-design-add-and-search-words-data-structure.mdx rename to apps/docs/content/(trie)/211-design-add-and-search-words-data-structure.mdx index b7b7c71..a89ba49 100644 --- a/apps/docs/content/(string)/211-design-add-and-search-words-data-structure.mdx +++ b/apps/docs/content/(trie)/211-design-add-and-search-words-data-structure.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Trie +String ### Constraints: @@ -98,7 +98,7 @@ class WordDictionary: # Your WordDictionary object will be instantiated and called as such: # obj = WordDictionary() # obj.addWord(word) -# param_2 = obj.search(word) +# param_3 = obj.search(word) ``` ## Explanation diff --git a/apps/docs/content/(trie)/meta.ts b/apps/docs/content/(trie)/meta.ts new file mode 100644 index 0000000..48852dd --- /dev/null +++ b/apps/docs/content/(trie)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Trie", order: 15 }); diff --git a/apps/docs/content/(array)/11-container-with-most-water.mdx b/apps/docs/content/(two-pointers)/11-container-with-most-water.mdx similarity index 97% rename from apps/docs/content/(array)/11-container-with-most-water.mdx rename to apps/docs/content/(two-pointers)/11-container-with-most-water.mdx index 8695ca8..ffe7a38 100644 --- a/apps/docs/content/(array)/11-container-with-most-water.mdx +++ b/apps/docs/content/(two-pointers)/11-container-with-most-water.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Two Pointers +Array ::::warning Notice that you may not slant the container. diff --git a/apps/docs/content/(array)/15-3sum.mdx b/apps/docs/content/(two-pointers)/15-3sum.mdx similarity index 98% rename from apps/docs/content/(array)/15-3sum.mdx rename to apps/docs/content/(two-pointers)/15-3sum.mdx index 92e1a94..d685543 100644 --- a/apps/docs/content/(array)/15-3sum.mdx +++ b/apps/docs/content/(two-pointers)/15-3sum.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Two Pointers +Array ::::warning Notice that the solution set must not contain duplicate triplets. diff --git a/apps/docs/content/(array)/167-two-sum-ii-input-array-is-sorted.mdx b/apps/docs/content/(two-pointers)/167-two-sum-ii-input-array-is-sorted.mdx similarity index 97% rename from apps/docs/content/(array)/167-two-sum-ii-input-array-is-sorted.mdx rename to apps/docs/content/(two-pointers)/167-two-sum-ii-input-array-is-sorted.mdx index 16922ae..d0ee600 100644 --- a/apps/docs/content/(array)/167-two-sum-ii-input-array-is-sorted.mdx +++ b/apps/docs/content/(two-pointers)/167-two-sum-ii-input-array-is-sorted.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Medium' --- -Two Pointers +Array ::::warning Your solution must use only constant extra space. diff --git a/apps/docs/content/(array)/977-squares-of-a-sorted-array.mdx b/apps/docs/content/(two-pointers)/977-squares-of-a-sorted-array.mdx similarity index 97% rename from apps/docs/content/(array)/977-squares-of-a-sorted-array.mdx rename to apps/docs/content/(two-pointers)/977-squares-of-a-sorted-array.mdx index a94ca09..a748ff3 100644 --- a/apps/docs/content/(array)/977-squares-of-a-sorted-array.mdx +++ b/apps/docs/content/(two-pointers)/977-squares-of-a-sorted-array.mdx @@ -6,7 +6,7 @@ sidebar: badge: 'Easy' --- -Two Pointers +Array ::::warning Squaring each element and sorting the new array is very trivial, could you find an O(n) solution using a different approach? diff --git a/apps/docs/content/(two-pointers)/meta.ts b/apps/docs/content/(two-pointers)/meta.ts new file mode 100644 index 0000000..f47f21c --- /dev/null +++ b/apps/docs/content/(two-pointers)/meta.ts @@ -0,0 +1,3 @@ +import { defineMeta } from "blume"; + +export default defineMeta({ title: "Two Pointers", order: 3 });