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 752 Open the Lock
Solutions for LeetCode 752, medium, tags: array, hash table, string, breadth-first search.
-
LeetCode 841 Keys and Rooms
Solutions for LeetCode 841, medium, tags: depth-first search, breadth-first search, graph.
-
LeetCode 547 Number of Provinces
Solutions for LeetCode 547, medium, tags: depth-first search, breadth-first search, union find, graph.
-
LeetCode 494 Target Sum
Solutions for LeetCode 494, medium, tags: array, dynamic programming, backtracking.
-
LeetCode 918 Maximum Sum Circular Subarray
Solutions for LeetCode 918, medium, tags: array, dynamic programming, divide and conquer, queue, monotonic queue.
-
LeetCode 130 Surrounded Regions
Solutions for LeetCode 130, medium, tags: array, depth-first search, breadth-first search, union find, matrix.
-
LeetCode 518 Coin Change II
Solutions for LeetCode 518, medium, tags: array, dynamic programming.
-
LeetCode 75 Sort Colors
Solutions for LeetCode 75, medium, tags: array, two pointers, sorting.
-
LeetCode 1631 Path With Minimum Effort
Solutions for LeetCode 1631, medium, tags: array, binary search, depth-first search, breadth-first search, union find, heap (priority queue), matrix.
-
LeetCode 36 Valid Sudoku
Solutions for LeetCode 36, medium, tags: array, hash table, matrix.
Recent Posts
-
System Design - How Paxos Consensus Works
How Paxos distributed consensus works: the protocol phases, roles (proposer, acceptor, learner), Multi-Paxos optimization, comparison with Raft, and real-world implementations in Google Chubby, Apache ZooKeeper, and Spanner.
-
System Design - How Gossip Protocols Work
How gossip protocols propagate information across distributed systems: epidemic dissemination, SWIM failure detection, push/pull/push-pull strategies, convergence analysis, and real-world implementations in Cassandra, Consul, and Redis Cluster.
-
System Design - How Coroutines and Async/Await Work Under the Hood
How coroutines power async/await: the difference between stackful and stackless coroutines, how Python transforms async functions into state machines, how Go's goroutines use stack-copying, and how the event loop ties it all together.
-
System Design - How HTTP/2 Multiplexing and Flow Control Works
How HTTP/2 multiplexing works: binary framing, streams, flow control, HPACK header compression, and server push — with ASCII diagrams and source code references from the Go net/http2 implementation.
-
System Design - How Circuit Breakers Work in Distributed Systems
How circuit breakers protect distributed systems from cascading failures: state machine design, failure detection, recovery probing, and a source code walkthrough of real implementations.
-
LeetCode 25 Reverse Nodes in k-Group
Solutions for LeetCode 25, hard, tags: linked list, recursion.
-
System Design - How Copy-on-Write (COW) Works
How Copy-on-Write works across operating systems, databases, and filesystems: the core mechanism behind fork(), Redis snapshots, LMDB reads, B-tree databases, and modern filesystems like Btrfs and ZFS.
-
LeetCode 329 Longest Increasing Path in a Matrix
Solutions for LeetCode 329, hard, tags: array, dynamic programming, depth-first search, breadth-first search, graph, topological sort, memoization, matrix.