Notes
Write-ups on what I build and the problems I run into along the way.
String to Integer (atoi)
String to Integer (atoi) written straight from the problem statement, then rewritten as a three state deterministic finite automaton.
Reverse Integer
Reverse Integer with the 32 bit range check done without ever holding a 64 bit integer, which is the constraint the problem actually cares about.
Longest Palindromic Substring
Four attempts at Longest Palindromic Substring, from a brute force that times out to expand around center, dynamic programming, and Manacher's.
Zigzag Conversion
Zigzag Conversion built the obvious way beats 5% of submissions, so the second attempt reads the pattern straight off the index arithmetic.
Add Two Numbers
Three ways to add two numbers stored as linked lists, from a plain carry loop to a version that stops as soon as one list runs out.
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters, from the O(n²) brute force to a sliding window backed first by a hash map and then by a set.
Median of Two Sorted Arrays
Median of Two Sorted Arrays in logarithmic time, and why the answer is to binary search the split point instead of merging the arrays at all.
Two Sum
Two Sum solved twice, first with the O(n²) nested loop and then with one pass that trades memory for an O(1) hash table lookup.