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 2352 Equal Row and Column Pairs
Solutions for LeetCode 2352, medium, tags: array, hash table, matrix.
-
LeetCode 1827 Minimum Operations to Make the Array Increasing
Solution for LeetCode 1827, easy, tags: array, greedy. One pass in Java, Python, C++, and Rust.
-
LeetCode 2530 Maximal Score After Applying K Operations
Solution for LeetCode 2530, medium, tags: array, greedy, heap (priority queue).
-
LeetCode 1129 Shortest Path with Alternating Colors
Solutions for LeetCode 1129, medium, tags: graph, breadth-first search.
-
LeetCode 2602 Minimum Operations to Make All Array Elements Equal
Solutions for LeetCode 2602, medium, tags: array, binary search, sorting, prefix sum.
-
LeetCode 2730 Find the Longest Semi-Repetitive Substring
Solutions for LeetCode 2730, medium, tags: string, sliding window, two pointers.
-
LeetCode 3066 Minimum Operations to Exceed Threshold Value II
A min-heap simulation that repeatedly combines the two smallest values, with overflow-safe implementations in four languages.
-
LeetCode 945 Minimum Increment to Make Array Unique
Solutions for LeetCode 945, medium, tags: array, greedy, sorting, counting.
-
LeetCode 1094 Car Pooling
Solutions for LeetCode 1094, medium, tags: array, sorting, heap, simulation, prefix sum.
-
LeetCode 289 Game of Life
Solutions for LeetCode 289, medium, tags: array, matrix, simulation.
Recent Posts
-
System Design - How OAuth 2.0 Authorization Code with PKCE Works
A beginner-friendly walkthrough of OAuth 2.0 authorization code with PKCE: redirects, one-time codes, proof keys, client types, token exchange, and the boundary between authorization and authentication.
-
System Design - How TiDB Prepared Plan Cache Reuses Plans Safely
A source walkthrough of TiDB's prepared plan cache: PlanCacheStmt, LRUPlanCache, PlanCacheValue, environment keys, parameter-type matching, range rebuilding, and the configurations that control reuse.
-
System Design - How TiKV Scheduler Latches Protect TiDB Writes
Follow two competing TiDB storage commands through five TiKV latch types: sorted key hashes, per-command ownership, bucket queues, wakeup retries, completion, and the configuration knobs that do not remove hot-key contention.
-
System Design - How PostgreSQL HOT Updates Work
Why PostgreSQL can sometimes update a row without adding new index entries: heap pages, HOT chains, snapshot visibility, pruning, fillfactor, and the source-code checks that make the optimization safe.
-
System Design - How TiDB TTL Workers Delete Expired Rows
Follow an expired row through five TiDB TTL worker types: key-range scanning, the delete-task channel, guarded DELETE transactions, retry handling, and the settings that control their impact on TiKV.
-
System Design - How the Transactional Outbox Works
Why saving a database row and publishing an event can fail, and how a transactional outbox connects PostgreSQL, Debezium, Kafka, and an idempotent consumer without pretending delivery happens exactly once.
-
System Design - How Kubernetes Deployment Rolling Updates Work
A beginner-friendly walkthrough of how a Kubernetes Deployment replaces Pods gradually, using ReplicaSets, readiness, maxSurge, and maxUnavailable.
-
System Design - How TiDB Auto Analyze Works
A source-code walkthrough of TiDB auto analyze, from the stats-owner scheduler and priority queue to TiDB's Analyze executor and TiKV coprocessor.