LeetCode 42: How Much Rain Water Can an Elevation Map Hold?

Problem Requirement You are given n non-negative integers in height. Each integer is the height of a bar with width 1, and all bars are adjacent from left to right. After rain, taller bars on both sides may hold water above shorter bars. Return the total amount of water trapped by the entire elevation map. LeetCode expects this interface: class Solution: def trap(self, height: List[int]) -> int: ... Example 1 Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Example 2 Input: height = [4,2,0,3,2,5] Output: 9 Constraints n == len(height) 1 <= n <= 2 * 10^4 0 <= height[i] <= 10^5 Step 1: First Answer How Much Water One Position Holds Do not calculate the whole elevation map yet. Focus on one position: ...

January 24, 2026 · 14 min · map[name:Jeanphilo]

Hot100: Maximum Subarray (Kadane O(n) ACERS Guide)

Subtitle / Summary Maximum Subarray is the classic 1D DP / greedy template. This ACERS guide explains Kadane’s idea, engineering use cases, and runnable multi-language solutions. Reading time: 10–12 min Tags: Hot100, dynamic programming, greedy SEO keywords: Maximum Subarray, Kadane, dynamic programming, O(n), Hot100 Meta description: Kadane O(n) maximum subarray sum with engineering scenarios and multi-language code. A — Algorithm Problem Restatement Given an integer array nums, find the contiguous subarray with the largest sum (must contain at least one element) and return the sum. ...

January 23, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 1437: Check If All 1's Are at Least K Apart (ACERS Guide)

Subtitle / Summary A classic event-spacing validation model. This ACERS guide explains the one-pass logic, engineering use cases, and runnable multi-language solutions. Reading time: 10–12 min Tags: array, two pointers, event spacing SEO keywords: LeetCode 1437, event spacing, O(n) Meta description: One-pass validation for minimum spacing between 1s, with engineering use cases and multi-language code. A — Algorithm Problem Restatement Given an integer array nums and integer k, return true if every pair of 1s is at least k apart; otherwise return false. ...

January 22, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 231: Power of Two (Bit Trick O(1) ACERS Guide)

Subtitle / Summary A classic bit-manipulation template: determine if a number is a power of two in O(1). This ACERS guide covers the core insight, practical uses, and runnable multi-language implementations. Reading time: 8–12 min Tags: bit manipulation, binary, math SEO keywords: Power of Two, bit manipulation, binary, O(1), LeetCode 231 Meta description: O(1) power-of-two check using bit tricks, with engineering scenarios and multi-language code. A — Algorithm Problem Restatement Given an integer n, determine whether it is a power of two. Return true if it is; otherwise, return false. ...

January 21, 2026 · 6 min · map[name:Jeanphilo]

LeetCode 1456: Maximum Number of Vowels in a Substring of Given Length (ACERS Guide)

Subtitle / Summary A standard fixed-window counting problem. This ACERS guide explains the sliding-window model, engineering use cases, and runnable multi-language solutions. Reading time: 10–12 min Tags: sliding window, string, fixed window SEO keywords: Maximum Number of Vowels, Sliding Window, Fixed Window Meta description: Fixed-window sliding count for maximum vowels with engineering applications. A — Algorithm Problem Restatement Given a string s and an integer k, return the maximum number of vowels in any substring of length k. ...

January 20, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 239: Sliding Window Maximum

Problem Requirement You are given an integer array nums and an integer k. A window of exactly k contiguous elements starts at the left edge of nums and moves one position to the right at a time. Return the maximum value from every window, in the same left-to-right order as the windows. The elements in a window must be contiguous. Their original order and positions do not change, and adjacent windows can overlap. Values do not need to be unique and may be negative. ...

January 19, 2026 · 13 min · map[name:Jeanphilo]

What Is size_t? Why C++ Loops Prefer size_t Over int

What Is size_t? Why C++ Loops Prefer size_t Over int Subtitle / Abstract When you iterate containers with a for loop, size_t is often safer and closer to the intended meaning than int. This post uses the ACERS structure to explain what size_t is, why it is used, the common pitfalls, and practical patterns for production C++. Meta Reading time: 8-10 minutes Tags: C++, size_t, type system, loops, STL SEO keywords: size_t usage, size_t vs int, C++ loop initialization, size_t underflow Meta description: Explain size_t and why loops often use it, with safe patterns and engineering scenarios. Target readers C++ beginners who are new to size_t, sizeof, and container size() return types Mid-level engineers who have seen -Wsign-compare warnings or unsigned underflow bugs Engineers writing cross-platform or high-performance C++ Background / Motivation In C++ code, you often see loops like: ...

December 30, 2025 · 6 min · map[name:Jeanphilo]

LeetCode 1512: Number of Good Pairs (Hash Counting ACERS Guide)

Subtitle / Abstract A basic counting problem: use frequency + combinations to drop O(n^2) to O(n). Includes engineering use cases and portable implementations. Reading time: 8-10 minutes Tags: hash-table, counting, array SEO keywords: Good Pairs, hash map, frequency Meta description: Hash counting solution for Good Pairs with complexity and code. Target readers Beginners learning hash tables and counting Engineers who want to map interview patterns to real stats tasks Interview prep for basic counting models Background / Motivation Counting equal pairs is a classic problem. A double loop is O(n^2). With frequency counting, you can solve it in linear time and scale to large data. ...

December 30, 2025 · 5 min · map[name:Jeanphilo]

XOR and RC4: From Principles to Go Practice (with Safer Alternatives)

XOR and RC4: From Principles to Go Practice (with Safer Alternatives) Subtitle / Abstract Use minimal math to explain XOR and RC4, provide runnable Go examples, and clarify why RC4 is considered insecure with recommended alternatives. Target readers Backend engineers reading legacy RC4 code Beginners who confuse encoding and encryption Intermediate developers building a stream-cipher mental model Background / Motivation Many systems still contain RC4 or custom decryption logic. Common mistakes include treating Base64 as encryption and ignoring integrity checks. Understanding XOR and RC4 helps you evaluate security correctly and avoid copying outdated designs into new systems. ...

December 16, 2025 · 3 min · map[name:Jeanphilo]

Sorting Series (Final): Practical Selection - Choose by Scale, Stability, Memory, Distribution

Practical selection guide: decision tables by scale/distribution/stability/memory, engineering scenarios, test checklist, and common pitfalls to apply the series.

December 9, 2025 · 4 min · map[name:Jeanphilo]