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
Ten small programs, each one producing a real error that disappears without a log, a stack trace or a non-zero exit code, with the measured output that proves it and the rule or line that finally made it visible.
AdminSeptember 9, 20269 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
The XOR and popcount tricks behind Single Number, Missing Number and Counting Bits are small enough to verify exhaustively, so this runs them over every input they claim to cover and reports the exact value at which each one stops being correct.
AdminSeptember 3, 20268 min read
Svelte 5 Runes: The New Reactivity Model Explained
Runes look like function calls but compile into signals, proxies and effects, so the fastest way to understand them is to read what svelte/compiler emits for each one.
AdminSeptember 2, 20266 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
Page 1 of 11Next

Stay in the Loop

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