JZLeetCode
RSS FeedHigh quality leet code solutions in Java, Python, C++, and Rust.
Comment in the Disqus section at the bottom of every post (you may have to refresh) if you have any questions. You can also share the solution on social media with the buttons at the bottom left of each post.
Please add a note that your reference or source is @JZLeetCode.
Social links for BuyMeCoffee is below and at the bottom right of every post. Donations are greatly appreciated and welcomed.
Read the blog posts or check About for more info.
Featured
-
LeetCode 1658 Minimum Operations to Reduce X to Zero
Solutions for LeetCode 1658, medium, tags: array, sliding window, prefix sum, hash table.
-
LeetCode 1208 Get Equal Substrings Within Budget
Solutions for LeetCode 1208, medium, tags: string, sliding window.
-
LeetCode 2736 Maximum Sum Queries
Solutions for LeetCode 2736, hard, tags: array, sorting, offline queries, Fenwick tree.
-
LeetCode 2012 Sum of Beauty in the Array
Solutions for LeetCode 2012, medium, tags: array, prefix maximum, suffix minimum.
-
LeetCode 992 Subarrays with K Different Integers
Count subarrays with exactly k distinct values by subtracting two sliding-window counts.
-
LeetCode 1248 Count Number of Nice Subarrays
Solutions for LeetCode 1248, medium, tags: array, hash table, prefix sum, sliding window.
-
LeetCode 1748 Sum of Unique Elements
Use a bounded frequency table in O(n) time, or sort and scan duplicate groups in O(n log n) time.
-
LeetCode 274 H-Index
Solutions for LeetCode 274, medium, tags: array, counting sort, sorting.
-
LeetCode 70 Climbing Stairs
Solution for LeetCode 70, easy, tags: dynamic programming, math.
-
LeetCode 1718 Construct the Lexicographically Largest Valid Sequence
Backtracking solutions for LeetCode 1718, medium, tags: array, backtracking.
Recent Posts
-
System Design - How Apache Spark Executes a Job
Follow an Apache Spark job from a lazy RDD transformation through stages, shuffle boundaries, tasks, executors, retries, and scheduling settings.
-
TiDB Source Walkthrough - How CREATE TABLE Becomes a DDL Job
Trace a regular TiDB CREATE TABLE statement through DDLExec, job submission, the DDL owner scheduler, metadata changes, and schema synchronization.
-
AI/ML - How LLM Tool Calling Works
Follow a model tool call from a structured request through application validation and execution, then back into the conversation as evidence for an answer.
-
System Design - How TiDB Retries Coprocessor Tasks After Region Splits
Trace one TiDB coprocessor scan from key ranges to region tasks, then follow an EpochNotMatch response through the region cache and task rebuild.
-
System Design - How CUDA GPU Kernels Execute Work
Trace a CUDA vector addition from the CPU's kernel launch into GPU blocks and warps, then see how synchronization, memory, and scheduling shape performance.
-
System Design - How TiDB Runaway Query Watch Works in Source Code
Follow TiDB's runaway-query rules from SQL configuration through the local watch cache and per-query checker to the coprocessor request path.
-
System Design - How Temporal Durable Execution Works
Updated:Follow a long-running Temporal workflow through event history, worker replay, activities, retries, and durable timers.
-
System Design - How TiDB SQL Bindings Reach the Optimizer
Updated:Trace a TiDB global SQL binding from CREATE BINDING through mysql.bind_info and per-instance caches to optimizer hint application.