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 46 Permutations
Solutions for LeetCode 46, medium, tags: array, backtracking.
-
LeetCode 198 House Robber
Solutions for LeetCode 198, medium, tags: array, dynamic programming.
-
LeetCode 17 Letter Combinations of a Phone Number
Solutions for LeetCode 17, medium, tags: hash table, string, backtracking.
-
LeetCode 54 Spiral Matrix
Solutions for LeetCode 54, medium, tags: array, matrix, simulation.
-
LeetCode 209 Minimum Size Subarray Sum
Solutions for LeetCode 209, medium, tags: array, binary search, sliding window, prefix sum.
-
LeetCode 121 Best Time to Buy and Sell Stock
Solutions for LeetCode 121, easy, tags: array, dynamic programming.
-
LeetCode 143 Reorder List
Solutions for LeetCode 143, medium, tags: linked list, two pointers, stack, recursion.
-
LeetCode 295 Find Median from Data Stream
Solutions for LeetCode 295, hard, tags: two pointers, design, sorting, heap, data stream.
-
LeetCode 139 Word Break
Solutions for LeetCode 139, medium, tags: dynamic programming, hash table, string, trie, memoization.
-
LeetCode 11 Container With Most Water
Solutions for LeetCode 11, medium, tags: array, two pointers, greedy.
Recent Posts
-
System Design - How Memory Allocators Work
How memory allocators work under the hood: malloc/free internals, free lists, splitting and coalescing, the buddy system, arena-based allocators like tcmalloc and jemalloc, and how modern allocators reduce lock contention in multi-threaded programs.
-
System Design - How the Linux Process Scheduler (CFS) Works
How Linux's Completely Fair Scheduler (CFS) works: virtual runtime, red-black tree scheduling, nice values, CPU bandwidth control, and source code walkthrough from the kernel's sched/fair.c.
-
System Design - How Linux io_uring Works
How Linux io_uring works: the submission and completion ring buffers, zero-copy I/O without system call overhead, kernel polling mode, and source code walkthrough from the liburing library.
-
System Design - How Two-Phase Commit (2PC) Works
How two-phase commit (2PC) works in distributed databases: the coordinator/participant model, prepare and commit phases, failure handling, recovery via write-ahead logging, and real-world implementations in PostgreSQL, MySQL, and TiDB.
-
System Design - How Vector Databases Work
How vector databases work: embedding vectors, similarity search, indexing with HNSW and IVF, distance metrics, quantization, and a look at how Milvus organizes its storage engine.
-
System Design - How TCP Congestion Control Works
How TCP congestion control works: slow start, congestion avoidance, fast retransmit, fast recovery, and modern algorithms like CUBIC and BBR — explained with ASCII diagrams and Linux kernel source references.
-
System Design - How Raft Consensus Algorithm Works
A deep dive into how Raft consensus algorithm achieves fault-tolerant replication in distributed systems — leader election, log replication, and safety guarantees explained with ASCII diagrams and source code references.
-
LeetCode 84 Largest Rectangle in Histogram
Solutions for LeetCode 84, hard, tags: array, stack, monotonic stack.