Software Engineer's Blog

Showing Posts From

Algorithm

Advanced Graphs: When BFS Isn't Enough

Coding Interview

Advanced Graphs: When BFS Isn't Enough

Jason Yang · 04 Aug, 2026

Advanced graphs in Java need named algorithms: Dijkstra for weighted shortest paths, Prim/Kruskal for a spanning tree, Bellman-Ford, and topological sort.

Bit Manipulation: A Handful of Bit Tricks

Coding Interview

Bit Manipulation: A Handful of Bit Tricks

Jason Yang · 04 Aug, 2026

Bit manipulation in Java rests on a few identities: XOR to cancel pairs, n & (n-1) to strip the lowest set bit, and shifts to add without a plus sign.

2D Dynamic Programming: A Table, Not an Array

Coding Interview

2D Dynamic Programming: A Table, Not an Array

Jason Yang · 04 Aug, 2026

2D DP in Java: when state needs two indices — two strings, a grid, or a mode — reading the recurrence from neighbor cells and rolling the table to O(n) space.

Tries: When Prefix Is the Question

Coding Interview

Tries: When Prefix Is the Question

Jason Yang · 04 Aug, 2026

A trie makes prefix a first-class query in Java: insert and startsWith in O(word length), wildcard matching, and a prefix tree that prunes a grid word search.

Intervals: Sort First, Then Sweep

Coding Interview

Intervals: Sort First, Then Sweep

Jason Yang · 04 Aug, 2026

Interval problems in Java almost all start by sorting, then one sweep: what to sort by, the overlap test, and counting concurrent intervals for room counts.

Heaps: The Top of the Pile Without Sorting It

Coding Interview

Heaps: The Top of the Pile Without Sorting It

Jason Yang · 04 Aug, 2026

Heap patterns in Java: the size-k trick for top-k, two heaps for a running median, and why a priority queue beats sorting when you only need the extreme.

Stacks: Remembering What Isn't Resolved Yet

Coding Interview

Stacks: Remembering What Isn't Resolved Yet

Jason Yang · 04 Aug, 2026

Stacks do two interview jobs in Java: matching what you must resolve later (parentheses, RPN), and the monotonic stack that finds next-greater in one O(n) pass.

Graphs: Most of Them Don't Look Like Graphs

Coding Interview

Graphs: Most of Them Don't Look Like Graphs

Jason Yang · 03 Aug, 2026

Most graph interview problems are disguised — grids, prerequisites, connectivity. How to spot them, the visited set trees never needed, and BFS vs DFS in Java.

Binary Trees: Recursion and the Right Traversal

Coding Interview

Binary Trees: Recursion and the Right Traversal

Jason Yang · 03 Aug, 2026

Binary tree problems in Java are recursion plus the right traversal: pre/in/post-order DFS vs BFS, what each recursive call returns, and the BST in-order trick.

How the Sliding Window Pattern Works (Java)

Coding Interview

How the Sliding Window Pattern Works (Java)

Jason Yang · 03 Aug, 2026

The sliding-window pattern in Java: fixed vs variable windows, what to track inside, and how it solves Longest Substring and Minimum Window in one O(n) pass.

The Two Pointers Pattern, Explained with Java

Coding Interview

The Two Pointers Pattern, Explained with Java

Jason Yang · 27 Mar, 2026

The two-pointer pattern in Java: how converging pointers turn an O(n²) brute force into a single O(n) pass, and the decision rule that makes it safe.

Divide and Conquer (D&C): Beyond Merge Sort

Coding Interview

Divide and Conquer (D&C): Beyond Merge Sort

Jason Yang · 03 Dec, 2025

Divide and Conquer is more than Merge Sort: the 3-step design paradigm, how it differs from plain recursion, and the interview patterns that use it.

Why is Binary Search O(log n)?

Coding Interview

Why is Binary Search O(log n)?

Jason Yang · 02 Dec, 2025

Binary Search runs in O(log n) because it halves the search space every step. Here's the intuition, the math proof, and how it compares to linear search.

Understanding Prefix and Suffix Patterns

Coding Interview

Understanding Prefix and Suffix Patterns

Jason Yang · 28 Nov, 2025

Prefix Sum and Suffix Product explained: what these algorithm terms really mean, why they beat naive recomputation, and where they show up in problems.