WRITING
Notes on building and running systems
Engineering write-ups — architecture, security, and the occasional war story.
#stack · 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
Trapping Rain Water: from O(n) space to O(1) with two pointers
The brute force is obvious. The prefix/suffix array approach is clean. The two-pointer solution is where it gets interesting — you can eliminate the auxiliary arrays entirely by recognising that you only need the running max from whichever side is shorter.Jun 13, 2026 · 15 min read · #00016
02
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
03
Evaluate Reverse Polish Notation: stack as the implicit expression tree
RPN is postfix notation — operators come after operands. The stack holds the pending operands. Each operator pops two, applies the operation, and pushes the result. By the end, exactly one value remains. The stack is the expression tree collapsed into one linear structure.Jun 13, 2026 · 10 min read · #00022
Occasional notes on what I'm building
Get an email when I publish a new post — engineering write-ups, no spam. Unsubscribe anytime.