WRITING
Notes on building and running systems
Engineering write-ups — architecture, security, and the occasional war story.
#string · All writing
Series
Tags
- #leetcode 50
- #array 13
- #dfs 11
- #bfs 9
- #dynamic-programming 9
- #recursion 9
- #trees 7
- #arrays 6
- #binary-search 6
- #hash-table 6
- #string 6
- #two-pointers 6
- #backtracking 4
- #dp 4
- #graphs 4
- #greedy 4
- #matrix 4
- #sliding-window 4
- #hash-map 3
- #heap-priority-queue 3
- #linked-list 3
- #stack 3
- #binary-search-tree 2
- #heap 2
- #math 2
- #memoization 2
- #priority-queue 2
- #sorting 2
- #strings 2
- #binary-tree 1
- #bit-manipulation 1
- #bucket-sort 1
- #counting 1
- #cycle-detection 1
- #divide-and-conquer 1
- #geometry 1
- #kadane 1
- #multi-source-bfs 1
- #prefix-sum 1
- #quickselect 1
- #simulation 1
- #string-matching 1
- #topological-sort 1
- #union-find 1
01
String Segmentation Is Just a DP Reachability Problem: Solving Word Break
LeetCode 139 looks like a string-matching puzzle but is really a reachability question over indices. Walk through all three approaches — brute-force recursion, top-down memoization, and bottom-up tabulation — to see exactly why the dp array works and which version holds up under real constraints.Jun 14, 2026 · 10 min read · #00051
02
Permutation in String: fixed-size window with a character count match
A permutation is just an anagram. So the question reduces to: does any window of length len(s1) in s2 have the same character frequencies as s1? A fixed-size sliding window with two frequency maps — or a single diff counter — answers it in O(n).Jun 13, 2026 · 15 min read · #00019
03
Valid Parentheses: LIFO is exactly what matching brackets need
The stack isn't a clever trick here — it's the natural data structure for this problem. You need the most recently opened bracket to match the next closing one. That's LIFO. The only question is when and how to pop.Jun 13, 2026 · 10 min read · #00021
04
Longest Repeating Character Replacement: the window validity trick
The insight is a single condition: if the window length minus the count of the most frequent character exceeds k, the window is invalid. Maintaining that condition while expanding right and shrinking left gives you the longest valid window in O(n).Jun 13, 2026 · 11 min read · #00018
05
Minimum Window Substring: variable window with a coverage counter
The hard part isn't the window mechanics — it's knowing when the window is valid. A coverage counter that tracks how many characters in t are fully satisfied lets you shrink from the left the moment you have a valid window, without rechecking the whole map each time.Jun 13, 2026 · 13 min read · #00020
06
Valid Palindrome: the two-pointer read from both ends
A string is a palindrome if it reads the same forwards and backwards after stripping non-alphanumeric characters. Two pointers placed at the ends and walked inward check this in O(n) time and O(1) space — no reversed copy needed.Jun 13, 2026 · 9 min read · #00012
Occasional notes on what I'm building
Get an email when I publish a new post — engineering write-ups, no spam. Unsubscribe anytime.