DevLift

Blog

Tutorials, guides, and insights to help you become a better developer.

Clear
Delete the `if (!numSet.has(num - 1))` guard from the standard LeetCode 128 solution and every test still passes, but the inner loop jumps from 31,999 iterations to 511,984,000 at n = 32,000.
AdminSeptember 18, 20266 min read
Task Scheduler: Two Answers That Have To Match
LeetCode 621 has two unrelated correct solutions — a heap simulation and a one-line formula — so running them against every task multiset up to size 14 crossed with every cooldown from 0 to 40 is a stronger test than any example you would write by hand.
AdminSeptember 17, 20266 min read
0/1 Knapsack: What the One-Array Rewrite Costs You
Collapsing the 0/1 knapsack DP table into a single array is taught as a free win, but it destroys the record of which items were chosen and introduces a loop-direction bug that returns a plausible wrong answer on roughly four instances in five.
AdminSeptember 16, 20267 min read
Bucket sort is O(n) and a size-k min-heap is O(n log k), but timing both on two million integers shows the comparison is decided by how many buckets you allocate rather than by k.
AdminSeptember 11, 20266 min read
Nearly every explanation of LeetCode 84 says the monotonic stack stays strictly increasing, and an assertion dropped into the loop shows that is false on 45,502 of 50,000 random histograms.
AdminSeptember 8, 20267 min read
Your Rate Limiter Says 10 Per Second. I Measured 20.
Four rate limiting algorithms, one request stream, and a harness that counts what each of them actually admits in the worst rolling second.
AdminAugust 13, 20268 min read
Do [1,4] and [4,5] Overlap? Answer That First
LeetCode 56 merges [1,4] and [4,5]; LeetCode 435 says they do not overlap at all. Closed versus half-open ends is the one real decision in interval problems, and most interval bugs come from never making it.
AdminAugust 11, 20268 min read
Dijkstra's Algorithm, and the Four Places It Quietly Breaks
Dijkstra's algorithm is four lines of greedy logic wrapped in machinery that fails quietly, so this post builds a binary-heap implementation in TypeScript, differential-tests it against Floyd-Warshall on 4,000 random graphs, and measures what the heap, the Array.shift() queue and the stale-entry check actually cost.
AdminAugust 10, 202612 min read

Stay in the Loop

Get notified about new courses, tutorials, and learning tips. No spam, unsubscribe anytime.