WRITING
Notes on building and running systems
Engineering write-ups — architecture, security, and the occasional war story.
#matrix · 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
Word Search: DFS backtracking that marks and unmarks its own path
LeetCode 79 is where backtracking stops being abstract — the grid forces you to track exactly which cells are in your current path, undo that state on every dead end, and restart cleanly. Two complete solutions showing how a single in-place mutation replaces a whole visited matrix.Jun 14, 2026 · 15 min read · #00044
02
Number of Islands: flood-fill, BFS, and when Union-Find actually earns its keep
LeetCode 200 asks you to count disconnected land masses in a binary grid. Three approaches — DFS flood-fill, BFS, and Union-Find — all get there, and the constraints tell you exactly which one to reach for and why.Jun 14, 2026 · 13 min read · #00045
03
Rotting Oranges: why multi-source BFS beats simulating minute by minute
LeetCode 994 asks how long contagion takes to spread across a grid. The naive simulation works, but a single-pass multi-source BFS is both cleaner and a full order of magnitude faster — and the constraints show exactly why.Jun 14, 2026 · 11 min read · #00048
04
Search a 2D Matrix: flattening the matrix index into one binary search
The matrix is guaranteed sorted row-by-row and column-wise — which means if you unroll it into a 1D array, it's fully sorted. Binary search on a virtual 1D array, converting mid back to (row, col): that's the whole trick.Jun 13, 2026 · 12 min read · #00024
Occasional notes on what I'm building
Get an email when I publish a new post — engineering write-ups, no spam. Unsubscribe anytime.