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 11 Container With Most Water
Solutions for LeetCode 11, medium, tags: array, two pointers, greedy.
-
LeetCode 84 Largest Rectangle in Histogram
Solutions for LeetCode 84, hard, tags: array, stack, monotonic stack.
-
LeetCode 22 Generate Parentheses
Solutions for LeetCode 22, medium, tags: string, dynamic programming, backtracking.
-
LeetCode 207 Course Schedule
Solutions for LeetCode 207, medium, tags: depth-first search, breadth-first search, graph, topological sort.
-
LeetCode 735 Asteroid Collision
Solutions for LeetCode 735, medium, tags: array, stack, simulation.
-
LeetCode 322 Coin Change
Solutions for LeetCode 322, medium, tags: array, dynamic programming, breadth-first search.
-
LeetCode 895 Maximum Frequency Stack
Solutions for LeetCode 895, hard, tags: hash table, stack, design, ordered set.
-
LeetCode 39 Combination Sum
Solutions for LeetCode 39, medium, tags: array, backtracking.
-
LeetCode 72 Edit Distance
Solutions for LeetCode 72, medium, tags: string, dynamic programming.
-
LeetCode 128 Longest Consecutive Sequence
Solutions for LeetCode 128, medium, tags: array, hash table, union find.
-
System Design - How Rate Limiting Works
How rate limiting works: token bucket, leaky bucket, fixed window counter, and sliding window log/counter algorithms with ASCII diagrams, source code walkthrough from Nginx, Guava, and Redis, and practical trade-offs.
Recent Posts
-
System Design - How Raft Consensus Algorithm Works
A deep dive into how Raft consensus algorithm achieves fault-tolerant replication in distributed systems — leader election, log replication, and safety guarantees explained with ASCII diagrams and source code references.
-
System Design - How Git Internals Work
How Git works under the hood: the four object types (blob, tree, commit, tag), content-addressable storage, refs and branches, the staging area (index), packfiles and delta compression, and merge strategies — with ASCII diagrams and source code walkthrough from the git/git repository.
-
LeetCode 2257 Count Unguarded Cells in the Grid
Updated:Solutions for LeetCode 2257, medium, tags: array, graph, simulation.
-
LeetCode 2461 Maximum Sum of Distinct Subarrays With Length K
Updated:Solutions for LeetCode 2461, medium, tags: array, sliding window, hash.
-
LeetCode 1574 Shortest Subarray to be Removed to Make Array Sorted
Updated:Solutions for LeetCode 1574, medium, tags: array, binary-search, two-pointers.
-
LeetCode 1652 Defuse the Bomb
Updated:Solutions for LeetCode 1652, easy, tags: array, sliding window.
-
System Design - How Linux epoll Works
How Linux epoll works: the evolution from select/poll, epoll's internal architecture with red-black trees and ready lists, level-triggered vs edge-triggered modes, and a source code walkthrough from the Linux kernel.
-
LeetCode 2064 Minimized Maximum of Products Distributed to Any Store
Updated:Solutions for LeetCode 2064, medium, tags: array, binary search, heap.