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 1653 Minimum Deletions to Make String Balanced
Solutions for LeetCode 1653, medium, tags: string, dynamic programming.
-
LeetCode 3042 Count Prefix and Suffix Pairs I
Count prefix and suffix pairs by checking each ordered index pair.
-
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.
Recent Posts
-
System Design - How HashiCorp Vault Issues Dynamic Database Credentials
Follow a database credential from workload authentication through Vault policies, a secrets engine, and a renewable lease to expiration and revocation.
-
System Design - How TiDB Implements SHOW WARNINGS
Trace a TiDB diagnostic from StatementContext through its warning handler into SHOW WARNINGS, including SQL mode, warning counts, and the ShowExec output path.
-
System Design - How Erasure Coding Protects Stored Data
Learn how storage systems combine data and parity fragments to recover lost data, and why the space savings come with repair and placement trade-offs.
-
System Design - How TiDB TableDual Produces Rows Without a Table
Trace TiDB's TableDual from a logical plan to an executor, including zero-column rows, empty results, and chunk settings.
-
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.