docs(docs): add LeetCode problem markdown pages and docs site assets

This commit is contained in:
Prad Nukala
2026-08-25 11:19:35 -04:00
parent cc6c2da859
commit 94b1e1af55
37 changed files with 2496 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.blume-verify/
+47
View File
@@ -0,0 +1,47 @@
---
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
sidebar:
label: 'Two Sum'
badge: 'Easy'
---
<Badge variant="accent">Hash Table</Badge>
::::warning
Can you come up with an algorithm that is less than O(n^2) time complexity?
::::
### Example 1:
- Input: `nums = [2,7,11,15], target = 9`
- Output: `[0,1]`
- Explanation: Because `nums[0] + nums[1]` == `9`, we return [0, 1].
### Example 2:
- Input: `nums = [3,2,4], target = 6`
- Output: `[1,2]`
### Example 3:
- Input: `nums = [3,3], target = 6`
- Output: `[0,1]`
### Constraints:
- `2 <= nums.length <= 10^4`
- `-10^9 <= nums[i] <= 10^9`
- `-10^9 <= target <= 10^9`
- Only one valid answer exists.
## Solution
```py
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
seen = {}
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
return []
```
@@ -0,0 +1,48 @@
---
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])
sidebar:
label: 'Container With Most Water'
badge: 'Medium'
---
<Badge variant="accent">Two Pointers</Badge>
::::warning
Notice that you may not slant the container.
::::
### Example 1:
- Input: `height = [1,8,6,2,5,4,8,3,7]`
- Output: `49`
- Explanation: The above vertical lines are represented by array `[1,8,6,2,5,4,8,3,7]`. In this case, the max area of water (blue section) the container can contain is `49`.
### Example 2:
- Input: `height = [1,1]`
- Output: `1`
### Constraints:
- `n == height.length`
- `2 <= n <= 10^5`
- `0 <= height[i] <= 10^4`
## Solution
```py
class Solution:
def maxArea(self, height: List[int]) -> int: # noqa: F821
res = 0
left = 0
right = len(height) - 1
while left < right:
area = (right - left) * min(height[left], height[right])
res = max(res, area)
if height[left] < height[right]:
left += 1
else:
right -= 1
return res
```
@@ -0,0 +1,38 @@
---
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
sidebar:
label: 'Best Time to Buy and Sell Stock'
badge: 'Easy'
---
<Badge variant="accent">Sliding Window</Badge>
### Example 1:
- Input: `prices = [7,1,5,3,6,4]`
- Output: `5`
- Explanation: Buy on day `2` (price = `1`) and sell on day `5` (price = `6`), profit = `6-1 = 5`. Note that buying on day `2` and selling on day `1` is not allowed because you must buy before you sell.
### Example 2:
- Input: `prices = [7,6,4,3,1]`
- Output: `0`
- Explanation: In this case, no transactions are done and the max profit = `0`.
### Constraints:
- `1 <= prices.length <= 10^5`
- `0 <= prices[i] <= 10^4`
## Solution
```py
class Solution:
def maxProfit(self, prices: List[int]) -> int:
left = min(prices)
for right in range(len(prices)):
while curr > left:
curr -= prices[left]
left += 1
ans = max(ans, curr)
return ans
```
@@ -0,0 +1,63 @@
---
title: '1365. How Many Numbers Are Smaller Than the Current Number'
description: Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]
sidebar:
label: 'How Many Numbers Are Smaller Than the Current Number'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `nums = [8,1,2,2,3]`
- Output: `[4,0,1,1,3]`
- Explanation: For `nums[0]=8` there exist four smaller numbers than it (`1`, `2`, `2` and `3`). For `nums[1]=1` does not exist any smaller number than it. For `nums[2]=2` there exist one smaller number than it (`1`). For `nums[3]=2` there exist one smaller number than it (`1`). For `nums[4]=3` there exist three smaller numbers than it (`1`, `2` and `2`).
### Example 2:
- Input: `nums = [6,5,4,8]`
- Output: `[2,1,0,3]`
### Example 3:
- Input: `nums = [7,7,7,7]`
- Output: `[0,0,0,0]`
### Constraints:
- `2 <= nums.length <= 500`
- `0 <= nums[i] <= 100`
## Solution
```js
/**
* @param {number[]} nums
* @return {number[]}
*/
var smallerNumbersThanCurrent = function (nums) {
// Step 1: Begin by initializing a [Frequency Map]()
const freq = {};
for (let n of nums) freq[n] = (freq[n] || 0) + 1;
// Step 2: Sort the numbers by ascending order
const sorted = Object.keys(freq).sort((a, b) => a - b);
// Step 3: Init a count of numbers smaller than the active number
let count = 0;
// Step 4: Init a map to track number of values smaller for each number
const smaller = {};
// Step 5: Iterate over the sorted list
for (let num of sorted) {
// Set count for active number
smaller[num] = count;
// Update the count by frequency
count += freq[num];
}
// Step 6: Use original list and find number of smaller values than it
return nums.map((n) => smaller[n]);
};
```
@@ -0,0 +1,57 @@
---
title: '1413. Minimum Value to Get Positive Step by Step Sum'
description: Given an array of integers nums, you start with an initial positive value startValue
sidebar:
label: 'Minimum Value to Get Positive Step by Step Sum'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `nums = [-3,2,-3,4,2]`
- Output: `5`
- Explanation: If you choose `startValue = 4`, in the third iteration your step by step sum is less than `1`.
```
step by step sum
startValue = 4 | startValue = 5 | nums
(4 -3 ) = 1 | (5 -3 ) = 2 | -3
(1 +2 ) = 3 | (2 +2 ) = 4 | 2
(3 -3 ) = 0 | (4 -3 ) = 1 | -3
(0 +4 ) = 4 | (1 +4 ) = 5 | 4
(4 +2 ) = 6 | (5 +2 ) = 7 | 2
```
### Example 2:
- Input: `nums = [1,2]`
- Output: `1`
- Explanation: Minimum start value should be positive.
### Example 3:
- Input: `nums = [1,-2,-3]`
- Output: `5`
### Constraints:
- `1 <= nums.length <= 100`
- `-100 <= nums[i] <= 100`
## Solution
```js
/**
* @param {number[]} nums
* @return {number}
*/
var minStartValue = function(nums) {
let prefix = [nums[0]];
// Make prefix sum start at 1 after initializing seed value
for (let i = 1; i < nums.length; i++){
prefix.push(prefix[i - 1] + nums[i]);
}
let min = Math.min(...prefix);
return Math.max(1, 1 - min);
};
```
@@ -0,0 +1,45 @@
---
title: '1426. Counting Elements'
description: Given an integer array arr, count how many elements x there are, such that x + 1 is also in arr. If there are duplicates in arr, count them separately
sidebar:
label: 'Counting Elements'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `arr = [1,2,3]`
- Output: `2`
- Explanation: `1` and `2` are counted cause `2` and `3` are in `arr`.
### Example 2:
- Input: `arr = [1,1,3,3,5,5,7,7]`
- Output: `0`
- Explanation: No numbers are counted, cause there is no `2`, `4`, `6`, or `8` in `arr`.
### Constraints:
- `1 <= arr.length <= 1000`
- `0 <= arr[i] <= 1000`
## Solution
```js
/**
* @param {number[]} arr
* @return {number}
*/
var countElements = function(arr) {
let arrSet = new Set(arr);
let count = 0;
for (let n of arr) {
let sum = n + 1;
if (arrSet.has(sum)) {
count++;
}
}
return count;
};
```
@@ -0,0 +1,44 @@
---
title: '1480. Running Sum of 1d Array'
description: Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]&hellip;nums[i])
sidebar:
label: 'Running Sum of 1d Array'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `nums = [1,2,3,4]`
- Output: `[1,3,6,10]`
- Explanation: Running sum is obtained as follows: `[1, 1+2, 1+2+3, 1+2+3+4]`.
### Example 2:
- Input: `nums = [1,1,1,1,1]`
- Output: `[1,2,3,4,5]`
- Explanation: Running sum is obtained as follows: `[1, 1+1, 1+1+1, 1+1+1+1, 1+1+1+1+1]`.
### Example 3:
- Input: `nums = [3,1,2,10,1]`
- Output: `[3,4,6,16,17]`
### Constraints:
- `1 <= nums.length <= 1000`
- `-10^6 <= nums[i] <= 10^6`
## Solution
```js
/**
* @param {number[]} nums
* @return {number[]}
*/
var runningSum = function(nums) {
let prefix = [nums[0]];
for (let i = 1; i < nums.length; i++){
prefix.push(prefix[i - 1] + nums[i]);
}
return prefix;
};
```
+78
View File
@@ -0,0 +1,78 @@
---
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
sidebar:
label: '3Sum'
badge: 'Medium'
---
<Badge variant="accent">Two Pointers</Badge>
::::warning
Notice that the solution set must not contain duplicate triplets.
::::
### Example 1:
- Input: `nums = [-1,0,1,2,-1,-4]`
- Output: `[[-1,-1,2],[-1,0,1]]`
- Explanation: `nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0`. `nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0`. `nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0`. The distinct triplets are `[-1,0,1]` and `[-1,-1,2]`. Notice that the order of the output and the order of the triplets does not matter.
### Example 2:
- Input: `nums = [0,1,1]`
- Output: `[]`
- Explanation: The only possible triplet does not sum up to `0`.
### Example 3:
- Input: `nums = [0,0,0]`
- Output: `[[0,0,0]]`
- Explanation: The only possible triplet sums up to `0`.
### Constraints:
- `3 <= nums.length <= 3000`
- `-10^5 <= nums[i] <= 10^5`
## Solution
```py
class Solution:
def threeSum(self, nums: list[int]) -> list[list[int]]:
nums.sort()
result = []
n = len(nums)
for i in range(n):
# skip all zero
if i > 0 and nums[i] == nums[i - 1]:
continue
# two pointers
left = i + 1
right = n - 1
target = -nums[i]
while left < right:
current = nums[left] + nums[right]
if current == target:
result.append([nums[i], nums[left], nums[right]])
# skip duplicates
while left < right and nums[left] == nums[left + 1]:
left += 1
while left < right and nums[right] == nums[right - 1]:
right -= 1
# shift pointers
left += 1
right -= 1
# since sorted, if current < target, then move left
elif current < target:
left += 1
# since sorted, if current > target, then move right
else:
right -= 1
return result
```
@@ -0,0 +1,42 @@
---
title: '1636. Sort Array by Increasing Frequency'
description: Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order
sidebar:
label: 'Sort Array by Increasing Frequency'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `nums = [1,1,2,2,2,3]`
- Output: `[3,1,1,2,2,2]`
- Explanation: `'3'` has a frequency of `1`, `'1'` has a frequency of `2`, and `'2'` has a frequency of `3`.
### Example 2:
- Input: `nums = [2,3,1,3,2]`
- Output: `[1,3,3,2,2]`
- Explanation: `'2'` and `'3'` both have a frequency of `2`, so they are sorted in decreasing order.
### Example 3:
- Input: `nums = [-1,1,-6,4,5,-6,1,4,1]`
- Output: `[5,-1,4,4,-6,-6,1,1,1]`
### Constraints:
- `1 <= nums.length <= 100`
- `-100 <= nums[i] <= 100`
## Solution
```js
/**
* @param {number[]} nums
* @return {number[]}
*/
var frequencySort = function (nums) {
const freq = {};
for (let n of nums) freq[n] = (freq[n] || 0) + 1;
return nums.sort((a, b) => freq[a] - freq[b] || b - a);
};
```
@@ -0,0 +1,55 @@
---
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
sidebar:
label: 'Two Sum II - Input Array Is Sorted'
badge: 'Medium'
---
<Badge variant="accent">Two Pointers</Badge>
::::warning
Your solution must use only constant extra space.
::::
### Example 1:
- Input: `numbers = [2,7,11,15], target = 9`
- Output: `[1,2]`
- Explanation: The sum of `2` and `7` is `9`. Therefore, `index1 = 1`, `index2 = 2`. We return `[1, 2]`.
### Example 2:
- Input: `numbers = [2,3,4], target = 6`
- Output: `[1,3]`
- Explanation: The sum of `2` and `4` is `6`. Therefore `index1 = 1`, `index2 = 3`. We return `[1, 3]`.
### Example 3:
- Input: `numbers = [-1,0], target = -1`
- Output: `[1,2]`
- Explanation: The sum of `-1` and `0` is `-1`. Therefore `index1 = 1`, `index2 = 2`. We return `[1, 2]`.
### Constraints:
- `2 <= numbers.length <= 3 * 10^4`
- `-1000 <= numbers[i] <= 1000`
- `numbers` is sorted in non-decreasing order.
- `-1000 <= target <= 1000`
- The tests are generated such that there is exactly one solution.
## Solution
```py
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
i = 0
j = len(numbers) - 1
while i < j:
c = numbers[i] + numbers[j]
if c == target:
return [i + 1, j + 1]
elif c < target:
i+=1
else:
j-=1
return []
```
@@ -0,0 +1,42 @@
---
title: '189. Rotate Array'
description: Given an integer array nums, rotate the array to the right by k steps, where k is non-negative
sidebar:
label: 'Rotate Array'
badge: 'Medium'
---
<Badge variant="accent">Two Pointers</Badge>
::::warning
Try to come up with as many solutions as you can. There are at least three different ways to solve this problem. Could you do it in-place with `O(1)` extra space?
::::
### Example 1:
- Input: `nums = [1,2,3,4,5,6,7], k = 3`
- Output: `[5,6,7,1,2,3,4]`
- Explanation: rotate 1 steps to the right: `[7,1,2,3,4,5,6]` rotate 2 steps to the right: `[6,7,1,2,3,4,5]` rotate 3 steps to the right: `[5,6,7,1,2,3,4]`
### Example 2:
- Input: `nums = [-1,-100,3,99], k = 2`
- Output: `[3,99,-1,-100]`
- Explanation: rotate 1 steps to the right: `[99,-1,-100,3]` rotate 2 steps to the right: `[3,99,-1,-100]`
### Constraints:
- `1 <= nums.length <= 10^5`
- `-2^31 <= nums[i] <= 2^31 - 1`
- `0 <= k <= 10^5`
## Solution
```js
/**
* @param {number[]} nums
* @param {number} k
* @return {void} Do not return anything, modify nums in-place instead.
*/
var rotate = function(nums, k) {
};
```
@@ -0,0 +1,50 @@
---
title: '2090. K Radius Subarray Averages'
description: You are given a 0-indexed array nums of n integers, and an integer k
sidebar:
label: 'K Radius Subarray Averages'
badge: 'Medium'
---
<Badge variant="accent">Array</Badge>
### Example 1:
- Input: `nums = [7,4,3,9,1,8,5,2,6], k = 3`
- Output: `[-1,-1,-1,5,4,4,-1,-1,-1]`
- Explanation:
- `avg[0]`, `avg[1]`, and `avg[2]` are `-1` because there are less than `k` elements before each index.
- The sum of the subarray centered at index `3` with radius `3` is: `7 + 4 + 3 + 9 + 1 + 8 + 5 = 37`. Using integer division, `avg[3] = 37 / 7 = 5`.
- For the subarray centered at index `4`, `avg[4] = (4 + 3 + 9 + 1 + 8 + 5 + 2) / 7 = 4`.
- For the subarray centered at index `5`, `avg[5] = (3 + 9 + 1 + 8 + 5 + 2 + 6) / 7 = 4`.
- `avg[6]`, `avg[7]`, and `avg[8]` are `-1` because there are less than `k` elements after each index.
### Example 2:
- Input: `nums = [100000], k = 0`
- Output: `[100000]`
- Explanation:
- The sum of the subarray centered at index `0` with radius `0` is: `100000`. `avg[0] = 100000 / 1 = 100000`.
### Example 3:
- Input: `nums = [8], k = 100000`
- Output: `[-1]`
- Explanation:
- `avg[0]` is `-1` because there are less than `k` elements before and after index `0`.
### Constraints:
- `n == nums.length`
- `1 <= n <= 10^5`
- `0 <= nums[i], k <= 10^5`
## Solution
```js
/**
* @param {number[]} nums
* @param {number} k
* @return {number[]}
*/
var getAverages = function(nums, k) {
};
```
@@ -0,0 +1,47 @@
---
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
sidebar:
label: 'Contains Duplicate'
badge: 'Easy'
---
<Badge variant="accent">Hash Table</Badge>
### Example 1:
- Input: `nums = [1,2,3,1]`
- Output: `true`
- Explanation: The element `1` occurs at the indices `0` and `3`.
### Example 2:
- Input: `nums = [1,2,3,4]`
- Output: `false`
- Explanation: All elements are distinct.
### Example 3:
- Input: `nums = [1,1,1,3,3,4,3,2,4,2]`
- Output: `true`
### Constraints:
- `1 <= nums.length <= 10^5`
- `-10^9 <= nums[i] <= 10^9`
## Solution
```js
/**
* @param {number[]} nums
* @return {boolean}
*/
var containsDuplicate = function(nums) {
const freq = {};
for (let n of nums) {
freq[n] = (freq[n] || 0) + 1;
if (freq[n] >= 2) {
return true;
}
}
return false;
};
```
@@ -0,0 +1,53 @@
---
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]
sidebar:
label: 'Product of Array Except Self'
badge: 'Medium'
---
<Badge variant="accent">Prefix Sum</Badge>
::::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.)
::::
### Example 1:
- Input: `nums = [1,2,3,4]`
- Output: `[24,12,8,6]`
### Example 2:
- Input: `nums = [-1,1,0,-3,3]`
- Output: `[0,0,9,0,0]`
### Constraints:
- `2 <= nums.length <= 10^5`
- `-30 <= nums[i] <= 30`
- The input is generated such that `answer[i]` is guaranteed to fit in a 32-bit integer.
## Solution
```js
/**
* @param {number[]} nums
* @return {number[]}
*/
var productExceptSelf = function(nums) {
const n = nums.length;
const answer = new Array(n).fill(1);
const rightArr = new Array(n).fill(1);
for (let i = 1; i < n; i++) {
answer[i] = nums[i - 1] * answer[i - 1];
}
for (let i = n - 2; i >= 0; i--) {
rightArr[i] = nums[i + 1] * rightArr[i + 1];
}
for (let i = 0; i < n; i++) {
answer[i] *= rightArr[i];
}
return answer;
};
```
@@ -0,0 +1,55 @@
---
title: '268. Missing Number'
description: Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array
sidebar:
label: 'Missing Number'
badge: 'Easy'
---
<Badge variant="accent">Array</Badge>
::::warning
Could you implement a solution using only O(1) extra space complexity and O(n) runtime complexity?
::::
### Example 1:
- Input: `nums = [3,0,1]`
- Output: `2`
- Explanation: `n = 3` since there are `3` numbers, so all numbers are in the range `[0,3]`. `2` is the missing number in the range since it does not appear in `nums`.
### Example 2:
- Input: `nums = [0,1]`
- Output: `2`
- Explanation: `n = 2` since there are `2` numbers, so all numbers are in the range `[0,2]`. `2` is the missing number in the range since it does not appear in `nums`.
### Example 3:
- Input: `nums = [9,6,4,2,3,5,7,0,1]`
- Output: `8`
- Explanation: `n = 9` since there are `9` numbers, so all numbers are in the range `[0,9]`. `8` is the missing number in the range since it does not appear in `nums`.
### Constraints:
- `n == nums.length`
- `1 <= n <= 10^4`
- `0 <= nums[i] <= n`
- All the numbers of `nums` are unique.
## Solution
```js
/**
* @param {number[]} nums
* @return {number}
*/
var missingNumber = function(nums) {
const numSet = new Set(nums);
const expectedCount = nums.length + 1;
for (let i = 0; i < expectedCount; i++){
if(!numSet.has(i)){
return i;
}
}
return -1;
};
```
@@ -0,0 +1,52 @@
---
title: '303. Range Sum Query - Immutable'
description: Given an integer array nums, handle multiple queries of the following type
sidebar:
label: 'Range Sum Query - Immutable'
badge: 'Easy'
---
<Badge variant="accent">Prefix Sum</Badge>
### Example 1:
- Input: `["NumArray", "sumRange", "sumRange", "sumRange"]` `[[[-2, 0, 3, -5, 2, -1]], [0, 2], [2, 5], [0, 5]]`
- Output: `[null, 1, -1, -3]`
- Explanation: `NumArray numArray = new NumArray([-2, 0, 3, -5, 2, -1]);` `numArray.sumRange(0, 2); // return (-2) + 0 + 3 = 1` `numArray.sumRange(2, 5); // return 3 + (-5) + 2 + (-1) = -1` `numArray.sumRange(0, 5); // return (-2) + 0 + 3 + (-5) + 2 + (-1) = -3`
### Constraints:
- `1 <= nums.length <= 10^4`
- `-10^5 <= nums[i] <= 10^5`
- `0 <= left <= right < nums.length`
- At most `10^4` calls will be made to `sumRange`.
## Solution
```js
/**
* @param {number[]} nums
*/
class NumArray {
constructor(nums) {
this.prefix = [0];
for (let n of nums){
this.prefix.push(this.prefix[this.prefix.length - 1] + n);
}
}
/**
* @param {number} left
* @param {number} right
* @return {number}
*/
sumRange(left, right) {
return this.prefix[right + 1] - this.prefix[left];
}
}
/**
* Your NumArray object will be instantiated and called as such:
* var obj = new NumArray(nums)
* var param_1 = obj.sumRange(left,right)
*/
```
@@ -0,0 +1,71 @@
---
title: '33. Search in Rotated Sorted Array'
description: There is an integer array nums sorted in ascending order (with distinct values)
sidebar:
label: 'Search in Rotated Sorted Array'
badge: 'Medium'
---
<Badge variant="accent">Binary Search</Badge>
::::warning
You must write an algorithm with O(log n) runtime complexity.
::::
### Example 1:
- Input: `nums = [4,5,6,7,0,1,2], target = 0`
- Output: `4`
### Example 2:
- Input: `nums = [4,5,6,7,0,1,2], target = 3`
- Output: `-1`
### Example 3:
- Input: `nums = [1], target = 0`
- Output: `-1`
### Constraints:
- `1 <= nums.length <= 5000`
- `-10^4 <= nums[i] <= 10^4`
- All values of `nums` are unique.
- `nums` is an ascending array that is possibly rotated.
- `-10^4 <= target <= 10^4`
## Solution
```js
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var search = function(nums, target) {
let l = 0, r = nums.length - 1;
while (l <= r){
let mid = Math.floor((l + r)/2);
if (target === nums[mid]) {
return mid
}
// Left sorted portion
if (nums[l] <= nums[mid]){
if (target > nums[mid] || target < nums[l]){
l = mid + 1;
}else{
r = mid - 1;
}
}
// Right sorted portion
else{
if(target < nums[mid] || target > nums[r]){
r = mid - 1;
}else{
l = mid + 1;
}
}
}
return -1;
};
```
@@ -0,0 +1,51 @@
---
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
sidebar:
label: 'Top K Frequent Elements'
badge: 'Medium'
---
<Badge variant="accent">Hash Table</Badge>
::::warning
Your algorithm's time complexity must be better than O(n log n), where n is the array's size.
::::
### Example 1:
- Input: `nums = [1,1,1,2,2,3], k = 2`
- Output: `[1,2]`
### Example 2:
- Input: `nums = [1], k = 1`
- Output: `[1]`
### Example 3:
- Input: `nums = [1,2,1,2,1,2,3,1,3,2], k = 2`
- Output: `[1,2]`
### Constraints:
- `1 <= nums.length <= 10^5`
- `-10^4 <= nums[i] <= 10^4`
- `k` is in the range `[1, the number of unique elements in the array]`.
- It is guaranteed that the answer is unique.
## Solution
```js
/**
* @param {number[]} nums
* @param {number} k
* @return {number[]}
*/
var topKFrequent = function (nums, k) {
const freq = {};
for (let n of nums) freq[n] = (freq[n] || 0) + 1;
return Object.keys(freq)
.map(Number)
.sort((a, b) => freq[b] - freq[a])
.slice(0, k);
};
```
@@ -0,0 +1,36 @@
---
title: '42. Trapping Rain Water'
description: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining
sidebar:
label: 'Trapping Rain Water'
badge: 'Hard'
---
<Badge variant="accent">Two Pointers</Badge>
### Example 1:
- Input: `height = [0,1,0,2,1,0,1,3,2,1,2,1]`
- Output: `6`
- Explanation: The above elevation map (black section) is represented by array `[0,1,0,2,1,0,1,3,2,1,2,1]`. In this case, `6` units of rain water (blue section) are being trapped.
### Example 2:
- Input: `height = [4,2,0,3,2,5]`
- Output: `9`
### Constraints:
- `n == height.length`
- `1 <= n <= 2 * 10^4`
- `0 <= height[i] <= 10^5`
## Solution
```js
/**
* @param {number[]} height
* @return {number}
*/
var trap = function(height) {
};
```
@@ -0,0 +1,51 @@
---
title: '49. Group Anagrams'
description: Given an array of strings strs, group the anagrams together. You can return the answer in any order
sidebar:
label: 'Group Anagrams'
badge: 'Medium'
---
<Badge variant="accent">Hash Table</Badge>
### Example 1:
- Input: `strs = ["eat","tea","tan","ate","nat","bat"]`
- Output: `[["bat"],["nat","tan"],["ate","eat","tea"]]`
- Explanation: There is no string in `strs` that can be rearranged to form `"bat"`. The strings `"nat"` and `"tan"` are anagrams as they can be rearranged to form each other. The strings `"ate"`, `"eat"`, and `"tea"` are anagrams as they can be rearranged to form each other.
### Example 2:
- Input: `strs = [""]`
- Output: `[[""]]`
### Example 3:
- Input: `strs = ["a"]`
- Output: `[["a"]]`
### Constraints:
- `1 <= strs.length <= 10^4`
- `0 <= strs[i].length <= 100`
- `strs[i]` consists of lowercase English letters.
## Solution
```js
/**
* @param {string[]} strs
* @return {string[][]}
*/
var groupAnagrams = function(strs) {
let sorted = strs.map(str => str.split("").sort().join(""));
let anagrams = {};
for (let i = 0; i < strs.length; i++){
if(!anagrams[sorted[i]]){
anagrams[sorted[i]] = [strs[i]]
}else{
anagrams[sorted[i]].push(strs[i])
}
}
return Object.values(anagrams);
};
```
@@ -0,0 +1,51 @@
---
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
sidebar:
label: 'Subarray Sum Equals K'
badge: 'Medium'
---
<Badge variant="accent">Prefix Sum</Badge>
### Example 1:
- Input: `nums = [1,1,1], k = 2`
- Output: `2`
### Example 2:
- Input: `nums = [1,2,3], k = 3`
- Output: `2`
### Constraints:
- `1 <= nums.length <= 2 * 10^4`
- `-1000 <= nums[i] <= 1000`
- `-10^7 <= k <= 10^7`
## Solution
```js
/**
* @param {number[]} nums
* @param {number} k
* @return {number}
*/
var subarraySum = function(nums, k) {
const map = new Map();
map.set(0, 1);
let sum = 0;
let count = 0;
for (let n of nums){
sum += n;
if(map.has(sum - k)){
count += map.get(sum - k);
}
map.set(sum, (map.get(sum) || 0) + 1);
}
return count
};
```
@@ -0,0 +1,56 @@
---
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
sidebar:
label: 'Binary Search'
badge: 'Easy'
---
<Badge variant="accent">Binary Search</Badge>
::::warning
You must write an algorithm with O(log n) runtime complexity.
::::
### Example 1:
- Input: `nums = [-1,0,3,5,9,12], target = 9`
- Output: `4`
- Explanation: `9` exists in `nums` and its index is `4`
### Example 2:
- Input: `nums = [-1,0,3,5,9,12], target = 2`
- Output: `-1`
- Explanation: `2` does not exist in `nums` so return `-1`
### Constraints:
- `1 <= nums.length <= 10^4`
- `-10^4 < nums[i], target < 10^4`
- All the integers in `nums` are unique.
- `nums` is sorted in ascending order.
## Solution
```js
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var search = function(nums, target) {
let left = 0;
let right = nums.length - 1;
while(left <= right) {
const mid = left + Math.floor((right - left) / 2);
if (nums[mid] === target) {
return mid;
} else if(nums[mid] < target){
left = mid + 1;
} else if (nums[mid] > target) {
right = mid - 1;
}
}
return -1;
};
```
@@ -0,0 +1,62 @@
---
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
sidebar:
label: 'Koko Eating Bananas'
badge: 'Medium'
---
<Badge variant="accent">Binary Search</Badge>
### Example 1:
- Input: `piles = [3,6,7,11], h = 8`
- Output: `4`
### Example 2:
- Input: `piles = [30,11,23,4,20], h = 5`
- Output: `30`
### Example 3:
- Input: `piles = [30,11,23,4,20], h = 6`
- Output: `23`
### Constraints:
- `1 <= piles.length <= 10^4`
- `piles.length <= h <= 10^9`
- `1 <= piles[i] <= 10^9`
## Solution
```js
/**
* @param {number[]} piles
* @param {number} h
* @return {number}
*/
var minEatingSpeed = function(piles, h) {
// Function to determine if K works for the H
function kWorks(k){
let hours = 0;
for (let p of piles){
hours += Math.ceil(p/k)
}
return hours <= h;
}
// Setup Binary Search
let l = 1;
let r = Math.max(...piles);
// Find the K value which works for H and consumes all bananas
while (l < r){
const mid = Math.floor((l + r) / 2);
if (kWorks(mid)){
r = mid;
}else{
l = mid + 1;
}
}
return l;
};
```
@@ -0,0 +1,55 @@
---
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
sidebar:
label: 'Squares of a Sorted Array'
badge: 'Easy'
---
<Badge variant="accent">Two Pointers</Badge>
::::warning
Squaring each element and sorting the new array is very trivial, could you find an O(n) solution using a different approach?
::::
### Example 1:
- Input: `nums = [-4,-1,0,3,10]`
- Output: `[0,1,9,16,100]`
- Explanation: After squaring, the array becomes `[16,1,0,9,100]`. After sorting, it becomes `[0,1,9,16,100]`.
### Example 2:
- Input: `nums = [-7,-3,2,3,11]`
- Output: `[4,9,9,49,121]`
### Constraints:
- `1 <= nums.length <= 10^4`
- `-10^4 <= nums[i] <= 10^4`
- `nums` is sorted in non-decreasing order.
## Solution
```js
/**
* @param {number[]} nums
* @return {number[]}
*/
var sortedSquares = function(nums) {
let n = nums.length;
let ans = new Array(nums.length);
let left = 0, right = nums.length - 1;
for (let i = n -1; i >= 0; i--){
let square;
if(Math.abs(nums[left]) < Math.abs(nums[right])){
square = nums[right];
right--;
}else{
square = nums[left];
left++;
}
ans[i] = square*square;
}
return ans;
};
```
@@ -0,0 +1,41 @@
---
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
sidebar:
label: 'Check if the Sentence Is Pangram'
badge: 'Easy'
---
<Badge variant="accent">Hash Table</Badge>
### Example 1:
- Input: `sentence = "thequickbrownfoxjumpsoverthelazydog"`
- Output: `true`
- Explanation: `sentence` contains at least one of every letter of the English alphabet.
### Example 2:
- Input: `sentence = "leetcode"`
- Output: `false`
### Constraints:
- `1 <= sentence.length <= 1000`
- `sentence` consists of lowercase English letters.
## Solution
```js
/**
* @param {string} sentence
* @return {boolean}
*/
var checkIfPangram = function(sentence) {
const freq = {};
for (let c of sentence) freq[c] = (freq[c] || 0) + 1;
if (Object.keys(freq).length === 26){
return true;
}
return false;
};
```
@@ -0,0 +1,48 @@
---
title: '242. Valid Anagram'
description: Given two strings s and t, return true if t is an anagram of s, and false otherwise
sidebar:
label: 'Valid Anagram'
badge: 'Easy'
---
<Badge variant="accent">Hash Table</Badge>
::::warning
What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
::::
### Example 1:
- Input: `s = "anagram", t = "nagaram"`
- Output: `true`
### Example 2:
- Input: `s = "rat", t = "car"`
- Output: `false`
### Constraints:
- `1 <= s.length, t.length <= 5 * 10^4`
- `s` and `t` consist of lowercase English letters.
## Solution
```js
/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isAnagram = function(s, t) {
let freq = {};
for (let c of s) freq[c] = (freq[c] || 0) + 1;
for (let c of t) {
if(!freq[c] || freq[c] === 0){
return false;
}
freq[c] = freq[c] - 1;
}
return true;
};
```
@@ -0,0 +1,47 @@
---
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
sidebar:
label: 'First Unique Character in a String'
badge: 'Easy'
---
<Badge variant="accent">Hash Table</Badge>
### Example 1:
- Input: `s = "leetcode"`
- Output: `0`
- Explanation: The character `'l'` at index `0` is the first character that does not occur at any other index.
### Example 2:
- Input: `s = "loveleetcode"`
- Output: `2`
### Example 3:
- Input: `s = "aabb"`
- Output: `-1`
### Constraints:
- `1 <= s.length <= 10^5`
- `s` consists of only lowercase English letters.
## Solution
```js
/**
* @param {string} s
* @return {number}
*/
var firstUniqChar = function (s) {
const freq = {};
for (let c of s) freq[c] = (freq[c] || 0) + 1;
for (let i = 0; i < s.length; i++) {
if (freq[s[i]] === 1) {
return i;
}
}
return -1;
};
```
@@ -0,0 +1,49 @@
---
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
sidebar:
label: 'Sort Characters By Frequency'
badge: 'Medium'
---
<Badge variant="accent">Hash Table</Badge>
### Example 1:
- Input: `s = "tree"`
- Output: `"eert"`
- Explanation: `'e'` appears twice while `'r'` and `'t'` both appear once. So `'e'` must appear before both `'r'` and `'t'`. Therefore `"eetr"` is also a valid answer.
### Example 2:
- Input: `s = "cccaaa"`
- Output: `"aaaccc"`
- Explanation: Both `'c'` and `'a'` appear three times, so both `"cccaaa"` and `"aaaccc"` are valid answers. Note that `"cacaca"` is incorrect, as the same characters must be together.
### Example 3:
- Input: `s = "Aabb"`
- Output: `"bbAa"`
- Explanation: `"bbaA"` is also a valid answer, but `"Aabb"` is incorrect. Note that `'A'` and `'a'` are treated as two different characters.
### Constraints:
- `1 <= s.length <= 5 * 10^5`
- `s` consists of uppercase and lowercase English letters and digits.
## Solution
```js
/**
* @param {string} s
* @return {string}
*/
var frequencySort = function (s) {
// count the frequency of each character
const freq = {};
for (let c of s) freq[c] = (freq[c] || 0) + 1;
// sort the characters by frequency
return s
.split("")
.sort((a, b) => freq[b] - freq[a] || a.localeCompare(b))
.join("");
};
```
@@ -0,0 +1,51 @@
---
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
sidebar:
label: 'Valid Palindrome'
badge: 'Easy'
---
<Badge variant="accent">Two Pointers</Badge>
### Example 1:
- Input: `s = "A man, a plan, a canal: Panama"`
- Output: `true`
- Explanation: `"amanaplanacanalpanama"` is a palindrome.
### Example 2:
- Input: `s = "race a car"`
- Output: `false`
- Explanation: `"raceacar"` is not a palindrome.
### Example 3:
- Input: `s = " "`
- Output: `true`
- Explanation: `s` is an empty string `""` after removing non-alphanumeric characters. Since an empty string reads the same forward and backward, it is a palindrome.
### Constraints:
- `1 <= s.length <= 2 * 10^5`
- `s` consists only of printable ASCII characters.
## Solution
```js
/**
* @param {string} s
* @return {boolean}
*/
var isPalindrome = function(s) {
let normal = s.replace(/[^a-zA-Z0-9]/g, "").toLowerCase()
let i = 0, j = normal.length - 1;
while (i < j) {
if(normal[i] !== normal[j]) {
return false;
}
i++;
j--;
}
return true;
};
```
@@ -0,0 +1,45 @@
---
title: '344. Reverse String'
description: Write a function that reverses a string. The input string is given as an array of characters s
sidebar:
label: 'Reverse String'
badge: 'Easy'
---
<Badge variant="accent">Two Pointers</Badge>
:::warning
You must do this by modifying the input array in-place with O(1) extra memory.
:::
### Example 1:
- Input: `s = ["h","e","l","l","o"]`
- Output: `["o","l","l","e","h"]`
### Example 2:
- Input: `s = ["H","a","n","n","a","h"]`
- Output: `["h","a","n","n","a","H"]`
### Constraints:
- `1 <= s.length <= 10^5`
- `s[i]` is a printable ascii character.
## Solution
```js
/**
* @param {character[]} s
* @return {void} Do not return anything, modify s in-place instead.
*/
var reverseString = function(s) {
let i = 0;
let j = s.length - 1;
while (i < j) {
[s[i], s[j]] = [s[j], s[i]];
j--;
i++;
}
};
```
@@ -0,0 +1,44 @@
---
title: '392. Is Subsequence'
description: Given two strings s and t, return true if s is a subsequence of t, or false otherwise
sidebar:
label: 'Is Subsequence'
badge: 'Easy'
---
<Badge variant="accent">Two Pointers</Badge>
::::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?
::::
### Example 1:
- Input: `s = "abc", t = "ahbgdc"`
- Output: `true`
### Example 2:
- Input: `s = "axc", t = "ahbgdc"`
- Output: `false`
### Constraints:
- `0 <= s.length <= 100`
- `0 <= t.length <= 10^4`
- `s` and `t` consist only of lowercase English letters.
## Solution
```py
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
if len(s) > len(t):
return False
i, j = 0, 0
while i < len(s) and j < len(t):
if s[i] == t[j]:
i += 1
j += 1
return i == len(s)
```
+12
View File
@@ -0,0 +1,12 @@
---
title: Introduction
description: Welcome to your new Blume docs.
---
## Getting Started
![Dependency Map](../public/dependency-spine.svg)
Welcome to **Blume** — markdown-first docs powered by Astro and Vite.
Edit `docs/index.mdx` to get started, then run `blume dev`.
+9
View File
@@ -0,0 +1,9 @@
---
title: Progress
description: Live SRS campaign dashboard — phases, ladder, review queue, gates, and recent attempts, fetched from the SRS Worker.
---
Live view of the 56-day campaign. Everything below is fetched client-side
from the SRS Worker, so it is always current — no rebuild required.
<ProgressDashboard />
+351
View File
@@ -0,0 +1,351 @@
/**
* Progress dashboard island — the expanded, always-current version of the
* daily email footer. Rendered on /progress; fetches campaign state from the
* SRS Worker at page load, entirely client-side, so `blume build` never
* depends on the API being up. API_BASE is a placeholder stamped in after the
* Worker deploys — do not inline it anywhere else.
*
* Invariants: the component never throws on malformed API data (a shape guard
* downgrades to the error state), and the first frame is always the loading
* state so server and client render identically.
*/
import { useEffect, useState, type CSSProperties } from "react";
export const client = "load";
const API_BASE = "https://srs-api.prdlk.workers.dev";
// ── /api/stats response shape ────────────────────────────────────
const STAGES = ["new", "+2", "+5", "+10", "retired"] as const;
type Stage = (typeof STAGES)[number];
interface Stats {
generated: string;
campaign: { day: number; week: number; start: string; days: number };
phases: {
milestone: number;
name: string;
core_done: number;
core_total: number;
optional_done: number;
optional_total: number;
deferred_done: number;
deferred_total: number;
}[];
ladder: Record<Stage, number>;
gates: {
week: number;
issue: number | null;
pass_rate: number | null;
closed_on: string | null;
}[];
streak: number;
queue: { date: string; due: number }[];
recent: { date: string; attempts: number; passes: number }[];
}
function isStats(value: unknown): value is Stats {
if (typeof value !== "object" || value === null) return false;
const v = value as Record<string, unknown>;
return (
typeof v.campaign === "object" &&
v.campaign !== null &&
typeof v.ladder === "object" &&
v.ladder !== null &&
Array.isArray(v.phases) &&
Array.isArray(v.gates) &&
Array.isArray(v.queue) &&
Array.isArray(v.recent) &&
typeof v.streak === "number"
);
}
// ── formatting ───────────────────────────────────────────────────
/** Legacy gates stored integer percent; the Worker may emit a 01 fraction. */
function percent(rate: number): string {
return `${Math.round(rate <= 1 ? rate * 100 : rate)}%`;
}
/** "2026-08-24" → "Mon 24" without timezone drift. */
function dayLabel(iso: string): string {
const d = new Date(`${iso}T00:00:00`);
const weekday = d.toLocaleDateString("en-US", { weekday: "short" });
return `${weekday} ${iso.slice(8)}`;
}
// ── shared styles (theme tokens only — no hand-rolled palette) ───
const card: CSSProperties = {
border: "1px solid var(--blume-border)",
borderRadius: "var(--blume-radius)",
padding: "0.75rem 1rem",
marginBottom: "1rem",
};
const muted: CSSProperties = {
color: "var(--blume-muted-foreground)",
fontSize: "0.85em",
};
const heading: CSSProperties = {
fontWeight: 600,
marginBottom: "0.5rem",
};
function Bar({ done, total }: { done: number; total: number }) {
const ratio = total > 0 ? Math.min(done / total, 1) : 0;
return (
<span
style={{
display: "inline-block",
width: "10rem",
maxWidth: "40vw",
height: "0.5rem",
borderRadius: "var(--blume-radius)",
background: "var(--blume-muted)",
verticalAlign: "middle",
overflow: "hidden",
}}
>
<span
style={{
display: "block",
width: `${ratio * 100}%`,
height: "100%",
background: "var(--blume-accent)",
}}
/>
</span>
);
}
// ── sections ─────────────────────────────────────────────────────
function Header({ stats }: { stats: Stats }) {
const { campaign, streak } = stats;
return (
<div style={{ ...card, display: "flex", gap: "1.5rem", flexWrap: "wrap" }}>
<span>
<strong>
Day {campaign.day}/{campaign.days}
</strong>
</span>
<span>Week {campaign.week}</span>
<span>
Streak: <strong>{streak}</strong> day{streak === 1 ? "" : "s"}
</span>
<span style={muted}>started {campaign.start}</span>
</div>
);
}
function Phases({ stats }: { stats: Stats }) {
return (
<div style={card}>
<div style={heading}>Phases</div>
<table style={{ borderCollapse: "collapse", width: "100%" }}>
<tbody>
{stats.phases.map((p) => (
<tr key={p.milestone}>
<td style={{ padding: "0.2rem 1rem 0.2rem 0" }}>{p.name}</td>
<td style={{ padding: "0.2rem 1rem 0.2rem 0" }}>
<Bar done={p.core_done} total={p.core_total} />{" "}
<span style={muted}>
core {p.core_done}/{p.core_total}
</span>
</td>
<td style={{ padding: "0.2rem 0" }}>
<span style={muted}>
optional {p.optional_done}/{p.optional_total}
{p.deferred_total > 0 &&
` · deferred ${p.deferred_done}/${p.deferred_total}`}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
function Ladder({ stats }: { stats: Stats }) {
return (
<div style={card}>
<div style={heading}>SRS ladder</div>
<div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap" }}>
{STAGES.map((stage) => (
<span
key={stage}
style={{
background: "var(--blume-muted)",
borderRadius: "var(--blume-radius)",
padding: "0.35rem 0.75rem",
}}
>
<span style={muted}>{stage}</span>{" "}
<strong>{stats.ladder[stage] ?? 0}</strong>
</span>
))}
</div>
</div>
);
}
function Queue({ stats }: { stats: Stats }) {
const max = Math.max(1, ...stats.queue.map((q) => q.due));
return (
<div style={card}>
<div style={heading}>Review queue next 14 days</div>
<table style={{ borderCollapse: "collapse" }}>
<tbody>
{stats.queue.map((q) => (
<tr key={q.date}>
<td style={{ ...muted, padding: "0.1rem 1rem 0.1rem 0" }}>
{dayLabel(q.date)}
</td>
<td style={{ padding: "0.1rem 0.75rem 0.1rem 0" }}>
<Bar done={q.due} total={max} />
</td>
<td>{q.due}</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
function Gates({ stats }: { stats: Stats }) {
return (
<div style={card}>
<div style={heading}>Gate log</div>
{stats.gates.length === 0 ? (
<span style={muted}>No gates yet.</span>
) : (
<table style={{ borderCollapse: "collapse", width: "100%" }}>
<thead>
<tr>
{["Week", "Issue", "Pass rate", "Closed"].map((h) => (
<th key={h} style={{ ...muted, textAlign: "left", padding: "0.2rem 1rem 0.2rem 0" }}>
{h}
</th>
))}
</tr>
</thead>
<tbody>
{stats.gates.map((g) => (
<tr key={g.week}>
<td style={{ padding: "0.2rem 1rem 0.2rem 0" }}>{g.week}</td>
<td style={{ padding: "0.2rem 1rem 0.2rem 0" }}>
{g.issue === null ? (
<span style={muted}></span>
) : (
<a
href={`https://github.com/prdlk/leetcode/issues/${g.issue}`}
target="_blank"
rel="noreferrer"
>
#{g.issue}
</a>
)}
</td>
<td style={{ padding: "0.2rem 1rem 0.2rem 0" }}>
{g.pass_rate === null ? (
<span style={muted}>open</span>
) : (
percent(g.pass_rate)
)}
</td>
<td style={{ padding: "0.2rem 0" }}>
{g.closed_on ?? <span style={muted}></span>}
</td>
</tr>
))}
</tbody>
</table>
)}
</div>
);
}
function Recent({ stats }: { stats: Stats }) {
return (
<div style={card}>
<div style={heading}>Last 7 days</div>
<div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap" }}>
{stats.recent.map((r) => (
<span
key={r.date}
style={{
border: "1px solid var(--blume-border)",
borderRadius: "var(--blume-radius)",
padding: "0.35rem 0.6rem",
textAlign: "center",
}}
>
<span style={{ ...muted, display: "block" }}>{dayLabel(r.date)}</span>
<strong>{r.passes}</strong>
<span style={muted}>/{r.attempts}</span>
</span>
))}
</div>
<div style={{ ...muted, marginTop: "0.4rem" }}>passes / attempts</div>
</div>
);
}
// ── dashboard ────────────────────────────────────────────────────
type Load =
| { phase: "loading" }
| { phase: "error" }
| { phase: "ready"; stats: Stats };
export default function ProgressDashboard() {
const [load, setLoad] = useState<Load>({ phase: "loading" });
useEffect(() => {
const controller = new AbortController();
fetch(`${API_BASE}/api/stats`, { signal: controller.signal })
.then((res) => {
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return res.json();
})
.then((body: unknown) => {
setLoad(isStats(body) ? { phase: "ready", stats: body } : { phase: "error" });
})
.catch(() => {
if (!controller.signal.aborted) setLoad({ phase: "error" });
});
return () => controller.abort();
}, []);
if (load.phase === "loading") {
return <p style={muted}>Loading progress</p>;
}
if (load.phase === "error") {
return (
<p style={muted}>
API unreachable stats are served live from the SRS Worker and it did
not respond.
</p>
);
}
const { stats } = load;
return (
<div>
<Header stats={stats} />
<Phases stats={stats} />
<Ladder stats={stats} />
<Queue stats={stats} />
<Gates stats={stats} />
<Recent stats={stats} />
<p style={muted}>Generated {stats.generated}</p>
</div>
);
}
+305
View File
@@ -0,0 +1,305 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LeetCode Dependency Spine</title>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--color-paper: #020202;
--color-ink: #f2f2f2;
--color-muted: #989898;
--color-accent: #449df0;
--font-sans: 'Inter', system-ui, sans-serif;
--font-serif: 'Instrument Serif', serif;
--font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}
body {
font-family: var(--font-sans);
background: var(--color-paper);
color: var(--color-ink);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 3rem 2rem;
}
.frame { max-width: 1360px; width: 100%; }
.eyebrow {
font-family: var(--font-mono);
font-size: 0.66rem;
font-weight: 500;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--color-muted);
margin-bottom: 0.5rem;
}
h1 {
font-family: var(--font-serif);
font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem);
font-weight: 400;
letter-spacing: -0.02em;
line-height: 1.15;
color: var(--color-ink);
margin-bottom: 1.5rem;
}
svg { width: 100%; min-width: 900px; display: block; }
</style>
</head>
<body>
<div class="frame">
<p class="eyebrow">prdlk / leetcode · dependency spine</p>
<h1>How the 24 topics build on each other</h1>
<svg viewBox="0 0 1472 648" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="dependency-spine-title dependency-spine-desc">
<title id="dependency-spine-title">LeetCode topic dependency spine</title>
<desc id="dependency-spine-desc">Dependency graph of 24 LeetCode study topics across five phases, showing which topics build on which, with Tree DFS and 1-D dynamic programming as the two central hubs.</desc>
<defs>
<marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#989898"/></marker>
<marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#449df0"/></marker>
<marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#6ab0f5"/></marker>
</defs>
<rect width="100%" height="100%" fill="#020202"/>
<!-- ============ zones (painted first) ============ -->
<rect x="40" y="40" width="368" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="56" y="44" width="168" height="12" rx="2" fill="#020202"/>
<text x="60" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE I — LINEAR STRUCTURES</text>
<rect x="456" y="40" width="368" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="472" y="44" width="152" height="12" rx="2" fill="#020202"/>
<text x="476" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE III — HIERARCHICAL</text>
<rect x="456" y="384" width="368" height="168" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="472" y="388" width="144" height="12" rx="2" fill="#020202"/>
<text x="476" y="397" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE II — NODAL &amp; GRID</text>
<rect x="872" y="40" width="560" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="888" y="44" width="264" height="12" rx="2" fill="#020202"/>
<text x="892" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASES IVV — RELATIONAL &amp; DECISION-SPACE</text>
<!-- ============ arrows (before boxes) ============ -->
<!-- same-row horizontals -->
<line x1="200" y1="168" x2="248" y2="168" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 3 → 4 -->
<line x1="200" y1="240" x2="248" y2="240" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 6 → 7 -->
<line x1="200" y1="312" x2="248" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 1 → 2 -->
<line x1="616" y1="440" x2="664" y2="440" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 8 → 9 -->
<line x1="1032" y1="96" x2="1080" y2="96" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 16 → 18 -->
<line x1="1224" y1="240" x2="1272" y2="240" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 21 → 22 -->
<line x1="1224" y1="312" x2="1272" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 23 → 24 -->
<line x1="616" y1="84" x2="888" y2="84" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 16 -->
<line x1="616" y1="312" x2="888" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 12 → 17 -->
<!-- same-column verticals -->
<line x1="544" y1="120" x2="544" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 13 -->
<line x1="960" y1="120" x2="960" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 16 → 19 -->
<line x1="1152" y1="120" x2="1152" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 18 → 20 -->
<line x1="1152" y1="192" x2="1152" y2="216" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 20 → 21 -->
<line x1="1152" y1="264" x2="1152" y2="288" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 21 → 23 -->
<!-- rounded right-angle elbows -->
<path d="M200,96 H416 Q424,96 424,104 V160 Q424,168 432,168 H472" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 5 → 13 -->
<path d="M616,96 H640 Q648,96 648,104 V160 Q648,168 656,168 H664" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 14 -->
<path d="M616,108 H624 Q632,108 632,116 V232 Q632,240 640,240 H664" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 15 -->
<path d="M392,184 H432 Q440,184 440,192 V504 Q440,512 448,512 H472" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 4 → 10 -->
<path d="M128,336 V560 Q128,568 136,568 H728 Q736,568 736,560 V464" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 1 → 9 -->
<!-- ============ nodes ============ -->
<!-- 05 Binary Search — entry -->
<rect x="56" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="72" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">05</text>
<text x="128" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Binary Search</text>
<!-- 03 Two Pointers — entry -->
<rect x="56" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="144" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">03</text>
<text x="128" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Two Pointers</text>
<!-- 04 Sliding Window -->
<rect x="248" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">04</text>
<text x="320" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Sliding Window</text>
<!-- 06 Stack — entry -->
<rect x="56" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="216" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">06</text>
<text x="128" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Stack</text>
<!-- 07 Monotonic Stack -->
<rect x="248" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">07</text>
<text x="320" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Monotonic Stack</text>
<!-- 01 Hash-Based Lookup — entry -->
<rect x="56" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="288" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">01</text>
<text x="128" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Hash Lookup</text>
<!-- 02 Prefix Sum -->
<rect x="248" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">02</text>
<text x="320" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Prefix Sum</text>
<!-- 11 Tree DFS — FOCAL -->
<rect x="472" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="72" width="144" height="48" rx="6" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<rect x="480" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(68,157,240,0.50)" stroke-width="0.8"/>
<text x="492" y="87" fill="#449df0" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">11</text>
<text x="544" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Tree DFS</text>
<!-- 13 Binary Search Tree -->
<rect x="472" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="480" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">13</text>
<text x="544" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Binary Search Tree</text>
<!-- 14 Heap -->
<rect x="664" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">14</text>
<text x="736" y="170" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Heap</text>
<text x="736" y="184" fill="#989898" font-size="9" font-family="'IBM Plex Mono', monospace" text-anchor="middle">priority queue</text>
<!-- 15 Trie -->
<rect x="664" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">15</text>
<text x="736" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Trie</text>
<!-- 12 Tree BFS — entry -->
<rect x="472" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="288" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="480" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">12</text>
<text x="544" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Tree BFS</text>
<!-- 08 Linked List — entry -->
<rect x="472" y="416" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="416" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="480" y="422" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="431" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">08</text>
<text x="544" y="448" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Linked List</text>
<!-- 09 Hybrid Structures -->
<rect x="664" y="416" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="416" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="422" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="431" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">09</text>
<text x="736" y="448" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Hybrid Structures</text>
<!-- 10 Matrix Index Math -->
<rect x="472" y="488" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="488" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="480" y="494" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="503" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">10</text>
<text x="544" y="520" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Matrix Index Math</text>
<!-- 16 Graph DFS -->
<rect x="888" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="72" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">16</text>
<text x="960" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Graph DFS</text>
<!-- 18 Topological Sort -->
<rect x="1080" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="72" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">18</text>
<text x="1152" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Topological Sort</text>
<!-- 19 Union-Find -->
<rect x="888" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">19</text>
<text x="960" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Union-Find</text>
<!-- 20 Backtracking -->
<rect x="1080" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">20</text>
<text x="1152" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Backtracking</text>
<!-- 21 1-D DP — FOCAL -->
<rect x="1080" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="216" width="144" height="48" rx="6" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<rect x="1088" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(68,157,240,0.50)" stroke-width="0.8"/>
<text x="1100" y="231" fill="#449df0" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">21</text>
<text x="1152" y="242" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">1-D DP</text>
<text x="1152" y="256" fill="#989898" font-size="9" font-family="'IBM Plex Mono', monospace" text-anchor="middle">dynamic programming</text>
<!-- 22 Multi-D / Grid DP -->
<rect x="1272" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1272" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1280" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1292" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">22</text>
<text x="1344" y="242" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Multi-D / Grid DP</text>
<!-- 17 Graph BFS -->
<rect x="888" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">17</text>
<text x="960" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Graph BFS</text>
<!-- 23 Greedy -->
<rect x="1080" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">23</text>
<text x="1152" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Greedy</text>
<!-- 24 Intervals -->
<rect x="1272" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1272" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1280" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1292" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">24</text>
<text x="1344" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Intervals</text>
<!-- ============ legend ============ -->
<line x1="40" y1="600" x2="1432" y2="600" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<text x="40" y="620" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">LEGEND</text>
<rect x="160" y="608" width="20" height="12" rx="2" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<text x="188" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">ENTRY — NO PREREQS</text>
<rect x="360" y="608" width="20" height="12" rx="2" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<text x="388" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">TOPIC</text>
<rect x="480" y="608" width="20" height="12" rx="2" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<text x="508" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">FOCAL HUB</text>
<line x1="624" y1="614" x2="656" y2="614" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/>
<text x="668" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">BUILDS ON</text>
<rect x="792" y="608" width="20" height="12" rx="2" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<text x="820" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">PHASE ZONE</text>
</svg>
</div>
</body>
</html>
+244
View File
@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 1472 648" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="dependency-spine-title dependency-spine-desc">
<title id="dependency-spine-title">LeetCode topic dependency spine</title>
<desc id="dependency-spine-desc">Dependency graph of 24 LeetCode study topics across five phases, showing which topics build on which, with Tree DFS and 1-D dynamic programming as the two central hubs.</desc>
<defs>
<style>@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&amp;family=Inter:wght@400;500;600&amp;family=IBM+Plex+Mono:wght@400;500;600&amp;display=swap');</style>
<marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#989898"/></marker>
<marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#449df0"/></marker>
<marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#6ab0f5"/></marker>
</defs>
<rect width="100%" height="100%" fill="#020202"/>
<!-- ============ zones (painted first) ============ -->
<rect x="40" y="40" width="368" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="56" y="44" width="168" height="12" rx="2" fill="#020202"/>
<text x="60" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE I — LINEAR STRUCTURES</text>
<rect x="456" y="40" width="368" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="472" y="44" width="152" height="12" rx="2" fill="#020202"/>
<text x="476" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE III — HIERARCHICAL</text>
<rect x="456" y="384" width="368" height="168" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="472" y="388" width="144" height="12" rx="2" fill="#020202"/>
<text x="476" y="397" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASE II — NODAL &amp; GRID</text>
<rect x="872" y="40" width="560" height="312" rx="8" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<rect x="888" y="44" width="264" height="12" rx="2" fill="#020202"/>
<text x="892" y="53" fill="rgba(242,242,242,0.40)" font-size="7" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">PHASES IVV — RELATIONAL &amp; DECISION-SPACE</text>
<!-- ============ arrows (before boxes) ============ -->
<!-- same-row horizontals -->
<line x1="200" y1="168" x2="248" y2="168" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 3 → 4 -->
<line x1="200" y1="240" x2="248" y2="240" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 6 → 7 -->
<line x1="200" y1="312" x2="248" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 1 → 2 -->
<line x1="616" y1="440" x2="664" y2="440" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 8 → 9 -->
<line x1="1032" y1="96" x2="1080" y2="96" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 16 → 18 -->
<line x1="1224" y1="240" x2="1272" y2="240" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 21 → 22 -->
<line x1="1224" y1="312" x2="1272" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 23 → 24 -->
<line x1="616" y1="84" x2="888" y2="84" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 16 -->
<line x1="616" y1="312" x2="888" y2="312" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 12 → 17 -->
<!-- same-column verticals -->
<line x1="544" y1="120" x2="544" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 13 -->
<line x1="960" y1="120" x2="960" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 16 → 19 -->
<line x1="1152" y1="120" x2="1152" y2="144" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 18 → 20 -->
<line x1="1152" y1="192" x2="1152" y2="216" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 20 → 21 -->
<line x1="1152" y1="264" x2="1152" y2="288" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 21 → 23 -->
<!-- rounded right-angle elbows -->
<path d="M200,96 H416 Q424,96 424,104 V160 Q424,168 432,168 H472" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 5 → 13 -->
<path d="M616,96 H640 Q648,96 648,104 V160 Q648,168 656,168 H664" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 14 -->
<path d="M616,108 H624 Q632,108 632,116 V232 Q632,240 640,240 H664" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 11 → 15 -->
<path d="M392,184 H432 Q440,184 440,192 V504 Q440,512 448,512 H472" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 4 → 10 -->
<path d="M128,336 V560 Q128,568 136,568 H728 Q736,568 736,560 V464" fill="none" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/> <!-- 1 → 9 -->
<!-- ============ nodes ============ -->
<!-- 05 Binary Search — entry -->
<rect x="56" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="72" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">05</text>
<text x="128" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Binary Search</text>
<!-- 03 Two Pointers — entry -->
<rect x="56" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="144" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">03</text>
<text x="128" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Two Pointers</text>
<!-- 04 Sliding Window -->
<rect x="248" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">04</text>
<text x="320" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Sliding Window</text>
<!-- 06 Stack — entry -->
<rect x="56" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="216" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">06</text>
<text x="128" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Stack</text>
<!-- 07 Monotonic Stack -->
<rect x="248" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">07</text>
<text x="320" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Monotonic Stack</text>
<!-- 01 Hash-Based Lookup — entry -->
<rect x="56" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="56" y="288" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="64" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="76" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">01</text>
<text x="128" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Hash Lookup</text>
<!-- 02 Prefix Sum -->
<rect x="248" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="248" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="256" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="268" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">02</text>
<text x="320" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Prefix Sum</text>
<!-- 11 Tree DFS — FOCAL -->
<rect x="472" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="72" width="144" height="48" rx="6" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<rect x="480" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(68,157,240,0.50)" stroke-width="0.8"/>
<text x="492" y="87" fill="#449df0" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">11</text>
<text x="544" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Tree DFS</text>
<!-- 13 Binary Search Tree -->
<rect x="472" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="480" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">13</text>
<text x="544" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Binary Search Tree</text>
<!-- 14 Heap -->
<rect x="664" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">14</text>
<text x="736" y="170" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Heap</text>
<text x="736" y="184" fill="#989898" font-size="9" font-family="'IBM Plex Mono', monospace" text-anchor="middle">priority queue</text>
<!-- 15 Trie -->
<rect x="664" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">15</text>
<text x="736" y="248" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Trie</text>
<!-- 12 Tree BFS — entry -->
<rect x="472" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="288" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="480" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">12</text>
<text x="544" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Tree BFS</text>
<!-- 08 Linked List — entry -->
<rect x="472" y="416" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="416" width="144" height="48" rx="6" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<rect x="480" y="422" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="431" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">08</text>
<text x="544" y="448" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Linked List</text>
<!-- 09 Hybrid Structures -->
<rect x="664" y="416" width="144" height="48" rx="6" fill="#020202"/>
<rect x="664" y="416" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="672" y="422" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="684" y="431" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">09</text>
<text x="736" y="448" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Hybrid Structures</text>
<!-- 10 Matrix Index Math -->
<rect x="472" y="488" width="144" height="48" rx="6" fill="#020202"/>
<rect x="472" y="488" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="480" y="494" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="492" y="503" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">10</text>
<text x="544" y="520" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Matrix Index Math</text>
<!-- 16 Graph DFS -->
<rect x="888" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="72" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">16</text>
<text x="960" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Graph DFS</text>
<!-- 18 Topological Sort -->
<rect x="1080" y="72" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="72" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="78" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="87" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">18</text>
<text x="1152" y="104" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Topological Sort</text>
<!-- 19 Union-Find -->
<rect x="888" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">19</text>
<text x="960" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Union-Find</text>
<!-- 20 Backtracking -->
<rect x="1080" y="144" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="144" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="150" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="159" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">20</text>
<text x="1152" y="176" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Backtracking</text>
<!-- 21 1-D DP — FOCAL -->
<rect x="1080" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="216" width="144" height="48" rx="6" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<rect x="1088" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(68,157,240,0.50)" stroke-width="0.8"/>
<text x="1100" y="231" fill="#449df0" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">21</text>
<text x="1152" y="242" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">1-D DP</text>
<text x="1152" y="256" fill="#989898" font-size="9" font-family="'IBM Plex Mono', monospace" text-anchor="middle">dynamic programming</text>
<!-- 22 Multi-D / Grid DP -->
<rect x="1272" y="216" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1272" y="216" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1280" y="222" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1292" y="231" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">22</text>
<text x="1344" y="242" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Multi-D / Grid DP</text>
<!-- 17 Graph BFS -->
<rect x="888" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="888" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="896" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="908" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">17</text>
<text x="960" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Graph BFS</text>
<!-- 23 Greedy -->
<rect x="1080" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1080" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1088" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1100" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">23</text>
<text x="1152" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Greedy</text>
<!-- 24 Intervals -->
<rect x="1272" y="288" width="144" height="48" rx="6" fill="#020202"/>
<rect x="1272" y="288" width="144" height="48" rx="6" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<rect x="1280" y="294" width="24" height="12" rx="2" fill="transparent" stroke="rgba(242,242,242,0.30)" stroke-width="0.8"/>
<text x="1292" y="303" fill="#989898" font-size="7" font-family="'IBM Plex Mono', monospace" text-anchor="middle" letter-spacing="0.08em">24</text>
<text x="1344" y="320" fill="#f2f2f2" font-size="12" font-weight="600" font-family="'Inter', sans-serif" text-anchor="middle">Intervals</text>
<!-- ============ legend ============ -->
<line x1="40" y1="600" x2="1432" y2="600" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<text x="40" y="620" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.14em">LEGEND</text>
<rect x="160" y="608" width="20" height="12" rx="2" fill="rgba(152,152,152,0.10)" stroke="#6f6f6f" stroke-width="1"/>
<text x="188" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">ENTRY — NO PREREQS</text>
<rect x="360" y="608" width="20" height="12" rx="2" fill="#0d0d0d" stroke="#f2f2f2" stroke-width="1"/>
<text x="388" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">TOPIC</text>
<rect x="480" y="608" width="20" height="12" rx="2" fill="rgba(68,157,240,0.12)" stroke="#449df0" stroke-width="1.2"/>
<text x="508" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">FOCAL HUB</text>
<line x1="624" y1="614" x2="656" y2="614" stroke="#989898" stroke-width="1" marker-end="url(#arrow)"/>
<text x="668" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">BUILDS ON</text>
<rect x="792" y="608" width="20" height="12" rx="2" fill="rgba(242,242,242,0.02)" stroke="rgba(242,242,242,0.10)" stroke-width="0.8"/>
<text x="820" y="618" fill="#989898" font-size="8" font-family="'IBM Plex Mono', monospace" letter-spacing="0.06em">PHASE ZONE</text>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB