String
LeetCode 763: Partition Labels
·2 mins
LeetCode
Medium
Hash-Table
Two-Pointers
String
Greedy
LeetCode 763 note: record each letter’s last index, extend the current part’s end while scanning, and cut when the scan reaches it
LeetCode 32: Longest Valid Parentheses
·3 mins
LeetCode
Hard
String
Dynamic-Programming
Stack
Bracket-Sequences
LeetCode 32 note: a stack of indices whose bottom is the position just before the current valid run; the length is i - stack[-1]
LeetCode 4097: Minimum Value of Merged Integers
·1 min
LeetCode
Easy
Array
String
Simulation
LeetCode 4097 note: only merge the fixed pairs (0,1), (2,3), …, stepping by 2, not every adjacent pair
LeetCode 449: Serialize and Deserialize BST
·2 mins
LeetCode
Medium
String
Tree
Depth-First-Search
Breadth-First-Search
Design
Binary-Search-Tree
Binary-Tree
LeetCode 449 note: for a BST, pre-order without null markers is enough; deserialize recursively with bounds in O(n)
LeetCode 331: Verify Preorder Serialization of a Binary Tree
·2 mins
LeetCode
Medium
String
Stack
Tree
Binary-Tree
LeetCode 331 note: count open slots: start with 1, every node fills one, a non-null node opens two more; never go negative and end at exactly 0
LeetCode 297: Serialize and Deserialize Binary Tree
·2 mins
LeetCode
Hard
String
Tree
Depth-First-Search
Breadth-First-Search
Design
Binary-Tree
LeetCode 297 note: pre-order with null markers identifies the tree uniquely; deserialize by consuming tokens from an iterator
String
·7 mins
Algorithm
String
Simulation
Hash-Table
Simulation by building a list, parsing by trying every pattern at each position, all substrings of length k, counting by character class, checking balanced substrings from a fixed start, and splitting into words
Two Pointers
·9 mins
Algorithm
Two-Pointers
String
Sorting
Converging pointers, one pointer per sequence, skipping blanks to compare positions, counting pairs after sorting, and the in-place write pointer
Trie
·3 mins
Algorithm
Trie
String
Prefix
Bit-Manipulation
Building a Trie from nested dicts, counting on nodes, pairing it with DFS, and when a Trie is not actually needed
LeetCode 1842: Next Palindrome Using Same Digits
·3 mins
LeetCode
Hard
Two-Pointers
String
LeetCode 1842 note: a palindrome is determined by its left half and the middle digit stays put; take the next permutation of the left half and mirror it
String DP
·2 mins
Algorithm
Dynamic-Programming
String
Lcs
Palindrome
Prefix tables, edit operations, subsequences, and interval palindrome DP
LeetCode 4019: Merge Close Characters II
·2 mins
LeetCode
Medium
Hash-Table
String
LeetCode 4019 note: kept characters never change again, so record each character’s last position in the result; a new character within k of it gets merged away