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 863 All Nodes Distance K in Binary Tree
Solutions for LeetCode 863, medium, tags: tree, DFS, BFS, binary tree.
-
LeetCode 355 Design Twitter
Solutions for LeetCode 355, medium, tags: hash table, linked list, design, heap.
-
LeetCode 1482 Minimum Number of Days to Make m Bouquets
Solutions for LeetCode 1482, medium, tags: array, binary search.
-
LeetCode 1162 As Far from Land as Possible
Solutions for LeetCode 1162, medium, tags: array, dynamic programming, breadth-first search, matrix.
-
LeetCode 2300 Successful Pairs of Spells and Potions
Solutions for LeetCode 2300, medium, tags: array, binary search, sorting.
-
LeetCode 456 132 Pattern
Solutions for LeetCode 456, medium, tags: array, stack, monotonic stack.
-
LeetCode 986 Interval List Intersections
Solutions for LeetCode 986, medium, tags: array, two pointers.
-
LeetCode 227 Basic Calculator II
Solutions for LeetCode 227, medium, tags: math, string, stack.
-
LeetCode 2616 Minimize the Maximum Difference of Pairs
Solutions for LeetCode 2616, medium, tags: array, binary search, greedy, sorting.
-
LeetCode 221 Maximal Square
Solutions for LeetCode 221, medium, tags: dynamic programming, matrix.
Recent Posts
-
System Design - How Distributed File Systems Work (GFS/HDFS)
How distributed file systems work: the architecture of Google File System and Hadoop HDFS, chunk-based storage, metadata management, replication, read/write flows, and fault tolerance — with source code references.
-
System Design - How Kubernetes Networking Works
How Kubernetes networking works: the flat network model, pod-to-pod communication via CNI plugins, Service abstraction with kube-proxy iptables/IPVS, DNS resolution with CoreDNS, and how packets actually flow from one pod to another.
-
System Design - How RocksDB Compaction Works
How RocksDB compaction works under the hood: leveled compaction scheduling, file picking, merge-sort mechanics, write amplification tradeoffs, and a source code walkthrough from the facebook/rocksdb repository.
-
System Design - How Search Engines Work (Inverted Indexes and Ranking)
How search engines work: inverted indexes, TF-IDF/BM25 scoring, query processing with skip pointers, distributed scatter-gather, and how Lucene organizes segments for near-real-time search.
-
System Design - How CPU Memory Ordering and Memory Models Work
How CPU memory ordering works: why instructions execute out of order, store buffers, the x86-TSO and ARM/RISC-V relaxed models, memory barriers, and how languages like C++ and Go map atomic operations to hardware fences.
-
LeetCode 332 Reconstruct Itinerary
Solutions for LeetCode 332, hard, tags: graph, depth-first search, Eulerian path.
-
System Design - How etcd Works
How etcd works: Raft consensus, bbolt storage engine, MVCC revisions, watch mechanism, lease system, linearizable reads, and how Kubernetes depends on it.
-
LeetCode 934 Shortest Bridge
Solutions for LeetCode 934, medium, tags: array, depth-first search, breadth-first search, matrix.