The Midpoint Bug in Binary Search
An analysis of a subtle bug in Binary Search related to calculating the midpoint. I explain the cause of integer overflow when adding lowerBound and upperBound, how to fix it with midPoint = lowerBound + (upperBound - lowerBound) / 2, and share the history of this bug in Programming Pearls.

Related Posts
Discover more content you might enjoy

1DevTool: The Developer Cockpit I Built Because I Was Drowning in Windows
I was running Claude Code, Codex, and Gemini CLI in three different terminals, plus VS Code, Chrome, Postman, and TablePlus — just to ship one feature. So I built 1DevTool: one window per project, every AI agent in one place, everything persists.

Server Compass: Why I Built a Desktop App to Turn Any $5 VPS Into My Own PaaS
I was tired of paying $20+/month for Vercel and Railway, but also tired of self-hosted panels eating 2GB of RAM on my $5 VPS. So I built Server Compass — a desktop app that connects to any VPS over SSH and gives you the full power of a managed PaaS, with zero server overhead and one-time pricing.

Accidentally Building a Blogging Platform
I hadn't written blog posts for a long time and realized I was too dependent on AI. To rebuild my writing habit and think more clearly, I decided to build a writing platform: write.rocks.

Vibe Coding - Rebuilding My Blog from Scratch and Rebranding to khoa.blog
Detailed walkthrough of rebuilding a blog from scratch with vibe coding, from data migration to implementing new features, helping readers understand the personal blog development process.

Teaching on Udemy
Sharing my 3-year teaching experience on Udemy with an impressive number - 357,093 minutes of students watching my videos (equivalent to 250 days). The post reflects on the benefits of creating online courses: developing curriculum skills, marketing, video recording and editing, presentation, and sales.
