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 210 Course Schedule II
Solutions for LeetCode 210, medium, tags: depth-first search, breadth-first search, graph, topological sort.
-
LeetCode 2101 Detonate the Maximum Bombs
Solutions for LeetCode 2101, medium, tags: array, math, depth-first search, breadth-first search, graph.
-
LeetCode 4 Median of Two Sorted Arrays
Solutions for LeetCode 4, hard, tags: array, binary search, divide and conquer.
-
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.
Recent Posts
-
System Design - How Protocol Buffers (Protobuf) Encoding Works
How Protocol Buffers encoding works internally: wire types, varint encoding, field tags, length-delimited records, and a byte-level walkthrough showing why protobuf messages are compact and fast to parse.
-
System Design - How Database Connection Pooling Works
How database connection pooling works: the cost of raw connections, pool lifecycle, idle/active management, connection multiplexing modes, HikariCP internals, and PgBouncer architecture with source code walkthrough.
-
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.
-
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.