Software Engineer's Blog

Blog posts — page 2

424. Longest Repeating Character Replacement

Coding Interview

424. Longest Repeating Character Replacement

Jason Yang · 04 Aug, 2026

Longest Repeating Character Replacement (LeetCode 424): why a window is valid when its length minus its most-frequent letter stays within k, solved in Java.

417. Pacific Atlantic Water Flow

Coding Interview

417. Pacific Atlantic Water Flow

Jason Yang · 04 Aug, 2026

Pacific Atlantic Water Flow (LeetCode 417): flip the flow and DFS inward from each ocean's border, then intersect the two reachable sets. Java solution.

371. Sum of Two Integers

Coding Interview

371. Sum of Two Integers

Jason Yang · 04 Aug, 2026

Sum of Two Integers (LeetCode 371): add two numbers using only XOR and AND. Here's why XOR is the sum, AND is the carry, and how the loop lands in Java.

347. Top K Frequent Elements

Coding Interview

347. Top K Frequent Elements

Jason Yang · 04 Aug, 2026

Top K Frequent Elements (LeetCode 347): count with a hash map, then beat the O(n log n) bound by bucketing values by frequency for an O(n) answer in Java.

338. Counting Bits

Coding Interview

338. Counting Bits

Jason Yang · 04 Aug, 2026

Counting Bits (LeetCode 338): why dp[i] = dp[i >> 1] + (i & 1) counts set bits in one linear pass, plus the built-in baseline it beats — in Java.