Welcome to your one-stop destination for all things tech! Insightful blogs, code snippets, and industry updates for developers of all levels — from Java and Spring Boot to Docker, Kafka, and AWS.
Sliding Window: The Pattern Behind Every Substring Question
The two-pointer playbook introduced the sliding window as one pattern among five. This post gives it the full treatment, because it is the pattern interviewers escalate through: the Easy fixed-size version, the Medium variable-size version, and the Hard frequency-constrained version are the same loop with a different constraint. Learn the loop once and the escalation is just a harder rule to maintain. The loop is: a window [l, r] where r expands every step and l shrinks only until the window satisfies the constraint again. The window is always valid when the shrink loop finishes — that invariant is the whole technique. And it is O(n) for a reason you can state in one sentence: l and r only ever move right, so each index enters the window once and leaves it once. No index is ever revisited, no matter how nested the code looks. I checked the bound empirically: across 2,000 random strings, the total shrink steps in the longest-substring loop never exceeded n. ...
Cyclic Sort: The O(n) Trick Behind "Find the Missing Number"
Cyclic sort is the highest-ROI pattern you’ve never been taught by name. The entire technique is one invariant: when the values come from a known range, every value belongs at its own index — so put it there. Value v goes to index v (for ranges starting at 0) or index v - 1 (for ranges starting at 1). After one placement pass, whatever sits at the wrong index is the answer: the missing number, the duplicate, the first gap. ...
Minimum Spanning Trees in Java Interviews: Kruskal vs Prim, and When the Interviewer Asks for the Second-Best
The setup is four cities and six possible roads, each with a cost. Connect all four cities so that every city is reachable from every other, and spend as little as possible. The answer is always exactly n-1 roads — fewer can’t connect everything, more must contain a cycle, and a cycle means you’re paying for a road you don’t need. A minimum spanning tree is the cheapest such set. ...
Bulkheads in Spring Boot: Stop One Slow Dependency From Sinking the Service
A ship stays afloat when one compartment floods because bulkheads — the watertight walls between sections — keep the water in one place. Your service has the same problem in reverse: one slow dependency floods the shared thread pool, and everything else drowns with it. A payment provider that takes 2 seconds instead of 200 milliseconds doesn’t just make payments slow. It occupies every request thread until the pool is full, and then your health endpoint, your login page, and your fast internal calls all queue behind it. The service isn’t broken. It’s busy — on someone else’s problem. ...
@Transactional: The 5 Traps That Silently Lose Your Data
@Transactional is the most trusted annotation in Spring Boot — and the most quietly misunderstood. It looks like one annotation doing one job: wrap this method in a transaction. In practice it is a proxy, a set of defaults inherited from EJB, and a handful of hints to Hibernate, and each of those has a sharp edge. None of the five traps below throws an error at the point where you make the mistake. They all fail silently, in production, weeks later. ...