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 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.
-
LeetCode 1624 Largest Substring Between Two Equal Characters
Solutions for LeetCode 1624, easy, tags: hash table, string.
-
LeetCode 94 Binary Tree Inorder Traversal
Solutions for LeetCode 94, easy, tags: tree, depth-first search, stack, binary tree.
Recent Posts
-
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.
-
System Design - How OpenTelemetry Collector Pipelines Work
A practical walkthrough of how the OpenTelemetry Collector receives telemetry, runs it through ordered pipelines, and exports it to observability backends.
-
System Design - How TiDB AUTO_RANDOM IDs Work in Source Code
A small TiDB source walkthrough of AUTO_RANDOM: how an insert combines a shard prefix with an allocated counter, and how that changes clustered row keys.
-
System Design - How Redis Streams and Consumer Groups Work
Follow a Redis Stream from XADD through consumer-group delivery, pending entries, acknowledgements, and recovery after a worker fails.
-
System Design - How TiDB Index Merge Combines Index Scans
Trace TiDB's union-type Index Merge from a physical plan through parallel index scans, duplicate-handle removal, and a table lookup.