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 127 Word Ladder
Solutions for LeetCode 127, hard, tags: hash table, string, breadth-first search.
-
LeetCode 2131 Longest Palindrome by Concatenating Two Letter Words
Solutions for LeetCode 2131, medium, tags: array, hash table, string, greedy, counting.
-
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.
Recent Posts
-
System Design - How the Linux Kernel Network Stack Works
How a packet travels from NIC hardware to your application's socket: interrupts, NAPI, sk_buff, protocol layers, and socket receive queues — a walkthrough of the Linux kernel network stack.
-
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.
-
LeetCode 130 Surrounded Regions
Solutions for LeetCode 130, medium, tags: array, depth-first search, breadth-first search, union find, matrix.
-
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.
-
LeetCode 518 Coin Change II
Solutions for LeetCode 518, medium, tags: array, dynamic programming.