LeetCode 338: Counting Bits by Reusing Smaller Results

Problem Requirement Given a non-negative integer n, return an array answer of length n + 1. For every index: answer[i] = the number of 1 bits in the binary representation of i The requested range includes both 0 and n. LeetCode provides this method contract: countBits(n: int) -> List[int] Example 1 Input: n = 2 Output: [0,1,1] 0 -> 0 -> 0 set bits 1 -> 1 -> 1 set bit 2 -> 10 -> 1 set bit Example 2 Input: n = 5 Output: [0,1,1,2,1,2] Constraints 0 <= n <= 10^5 Step 1: This Time We Need Every Answer From 0 to n LeetCode 191 asks for one integer’s set-bit count. For n = 5, this problem asks for all six related answers: ...

July 15, 2026 · 5 min · map[name:Jeanphilo]

LeetCode 739: Daily Temperatures and the First Warmer Day to the Right

Problem Requirement You are given an integer array temperatures, where temperatures[i] is the temperature on day i. Return an array answer where: answer[i] = the number of days after day i until a warmer temperature If no later day is warmer, answer[i] = 0. “Warmer” means strictly greater. An equal temperature does not resolve a waiting day. LeetCode provides this method contract: dailyTemperatures(temperatures: List[int]) -> List[int] Example Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,0,0] Constraints 1 <= temperatures.length <= 10^5 30 <= temperatures[i] <= 100 Step 1: The Answer Is a Waiting Time, Not a Temperature Start with a smaller input: ...

July 15, 2026 · 6 min · map[name:Jeanphilo]

LeetCode 45: Jump Game II From Reachability to Minimum Jumps

Subtitle / Summary Jump Game II is not just reachability. It asks how many coverage layers are needed to reach the last index. Reading time: 8-10 min Tags: Hot100, greedy, array, reachability boundary SEO keywords: LeetCode 45, Jump Game II, greedy, current_end, farthest, minimum jumps Meta description: A pressure-first Python guide to LeetCode 45 that derives the minimum-jump greedy scan from coverage layers. Problem Requirement You are given an integer array nums. ...

July 8, 2026 · 9 min · map[name:Jeanphilo]

LeetCode 435: Non-overlapping Intervals From Minimum Removals to Maximum Kept

Subtitle / Summary Non-overlapping Intervals is easier when you stop asking which interval to delete first. First ask how many intervals can remain. Reading time: 8-10 min Tags: Hot100, greedy, intervals, sorting SEO keywords: LeetCode 435, Non-overlapping Intervals, greedy, interval greedy Meta description: A pressure-first Python guide to LeetCode 435 that derives minimum removals from maximum kept intervals and an earliest-ending greedy scan. Problem Requirement You are given an array of intervals intervals. ...

July 6, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 452: Minimum Number of Arrows From Shared Intersections to Interval Greedy

Subtitle / Summary A single arrow does not belong to one balloon. It belongs to a group of balloon intervals that share at least one x-position. Reading time: 9-11 min Tags: Hot100, greedy, intervals, sorting SEO keywords: LeetCode 452, Minimum Number of Arrows to Burst Balloons, greedy, interval greedy Meta description: A pressure-first Python guide to LeetCode 452 that derives shared intersections, an intersection-scanning baseline, and the final arrow position greedy. Problem Requirement You are given an array points. ...

July 6, 2026 · 8 min · map[name:Jeanphilo]

LeetCode 121: Best Time to Buy and Sell Stock With Greedy

Subtitle / Summary The greedy idea is not “buy low, sell high” as a slogan. The precise rule is: if today is the sell day, the best buy day must be the lowest price before today. Reading time: 8-10 min Tags: Hot100, greedy, array, stock SEO keywords: LeetCode 121, Best Time to Buy and Sell Stock, greedy, historical minimum price Meta description: A pressure-first Python guide to LeetCode 121 that derives brute force, historical minimum price, and the final one-pass greedy solution. Problem Requirement You are given an array prices, where prices[i] is the stock price on day i. ...

July 3, 2026 · 6 min · map[name:Jeanphilo]

LeetCode 55: Jump Game With Farthest Reach Greedy

Subtitle / Summary Jump Game is not about guessing one path. It is about maintaining how far all reachable positions can cover. Reading time: 8-10 min Tags: Hot100, greedy, array, reachability SEO keywords: LeetCode 55, Jump Game, greedy, farthest reach, reachability Meta description: A pressure-first Python guide to LeetCode 55 that derives a reachable-array baseline and compresses it into the farthest reachable range. Problem Requirement You are given an integer array nums. ...

July 3, 2026 · 6 min · map[name:Jeanphilo]

LeetCode 200: Number of Islands With Union-Find

Subtitle / Summary Do not start this problem by memorizing a Union-Find template. Start from the pressure: each land cell looks like one island at first, but adjacent land cells must collapse into one connected component. Reading time: 10-12 min Tags: Hot100, Union-Find, DSU, matrix, connected components SEO keywords: LeetCode 200, Number of Islands, Union-Find, DSU, connected components Meta description: A pressure-first Python guide to LeetCode 200 that derives land-only count, 2D-to-1D ids, Union-Find merges, and the final runnable solution. Problem Requirement You are given an m x n 2D character grid: ...

July 2, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 684: Redundant Connection With Union-Find

Subtitle / Summary The key signal in this problem is not a component count. It is a failed union: if two endpoints are already connected, adding the current edge closes a cycle. Reading time: 8-10 min Tags: Union-Find, DSU, graph, tree, cycle detection SEO keywords: LeetCode 684, Redundant Connection, Union-Find, DSU, cycle detection Meta description: A pressure-first Python guide to LeetCode 684 that derives 1-indexed Union-Find, bool-returning union, ordered edge scanning, and final checks. Problem Requirement You are given an undirected graph. It started as a tree with n nodes labeled from 1 to n, then one extra edge was added. ...

July 2, 2026 · 7 min · map[name:Jeanphilo]

Union-Find Template: Derive find / union / count

Subtitle / Summary Union-Find is not a pair of function names to memorize first. It solves one concrete problem: decide whether two nodes already belong to the same set, and merge two sets when a connection appears. Reading time: 10-12 min Tags: Hot100, Union-Find, DSU, graph, connectivity SEO keywords: Union-Find, DSU, Disjoint Set Union, find, union, count, path compression Meta description: A Python Union-Find template guide that derives parent, find, union, count, connected, path compression, and connected component counting. A - Algorithm: Start From Set-Merging Pressure Tiny task: merge sets and answer connectivity Suppose we have 5 nodes: ...

June 30, 2026 · 10 min · map[name:Jeanphilo]