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 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.
-
LeetCode 332 Reconstruct Itinerary
Solutions for LeetCode 332, hard, tags: graph, depth-first search, Eulerian path.
-
LeetCode 934 Shortest Bridge
Solutions for LeetCode 934, medium, tags: array, depth-first search, breadth-first search, matrix.
-
LeetCode 90 Subsets II
Solutions for LeetCode 90, medium, tags: array, backtracking, bit manipulation.
-
LeetCode 279 Perfect Squares
Solutions for LeetCode 279, medium, tags: dynamic programming, math.
Recent Posts
-
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.
-
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.
-
System Design - How Load Balancers Work
How load balancers work: L4 vs L7, algorithms (round-robin, least-connections, consistent hashing), health checks, connection draining, and source code walkthrough from HAProxy and Nginx.
-
LeetCode 410 Split Array Largest Sum
Solutions for LeetCode 410, hard, tags: array, binary search, dynamic programming, greedy, prefix sum.
-
System Design - How Kubernetes Pod Scheduling Works
How Kubernetes pod scheduling works: the scheduling queue, filtering (predicates), scoring (priorities), binding, preemption, and a source code walkthrough from the kubernetes/kubernetes repository.
-
LeetCode 1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
Solutions for LeetCode 1438, medium, tags: array, queue, sliding window, ordered set, monotonic queue.