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 2369 Check if There is a Valid Partition For The Array
Solution for LeetCode 2369, medium, tags: array, dynamic programming.
-
LeetCode 2090 K Radius Subarray Averages
Solutions for LeetCode 2090, medium, tags: array, sliding window, prefix sum.
-
LeetCode 2592 Maximize Greatness of an Array
Solutions for LeetCode 2592, medium, tags: array, two pointers, greedy, sorting.
-
LeetCode 1358 Number of Substrings Containing All Three Characters
Solutions for LeetCode 1358, medium, tags: string, sliding window, counting.
-
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.
Recent Posts
-
System Design - How RabbitMQ Confirms and Acknowledgements Work
Follow a RabbitMQ message from publisher to worker: routing, publisher confirms, quorum queues, manual acknowledgements, prefetch, and why retries still require idempotent processing.
-
System Design - How TiDB ADMIN CHECKSUM TABLE Works in Source
Trace TiDB's ADMIN CHECKSUM TABLE through five structs in TiDB and TiKV: snapshot selection, table and index tasks, CRC64-XOR scanning, result reduction, and concurrency settings.
-
System Design - How Redis Cluster Routes Keys and Survives Failures
A guided tour of Redis Cluster's hash slots, client routing, resharding redirects, gossip, replica elections, and write-safety trade-offs.
-
System Design - How TiDB Parallel Hash Aggregation Works in Source
A source-level tour of TiDB's root HashAgg plan, partial and final workers, group-key routing, result chunks, and memory spill settings.
-
System Design - How Kubernetes Operators Reconcile Applications
A beginner-friendly walkthrough of Kubernetes operators, custom resources, reconciliation loops, status, ownership, and the settings that shape a controller.
-
System Design - How TiDB Isolates a Failed Statement Inside a Transaction
A source walkthrough of TiDB's LazyTxn and MemBuffer staging: how a successful statement joins a transaction while a failed statement's writes are discarded.
-
System Design - How Apache Pulsar Stores and Delivers Messages
Follow a message through Apache Pulsar's broker, BookKeeper ledger, and subscription cursor to see how durable storage and independent consumers fit together.
-
System Design - How TiKV Checks and Splits Large Regions
Trace TiKV's classic Raftstore split check from an encoded TiDB key to a validated BatchSplit request, including the worker, thresholds, and key configs.