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 42 Trapping Rain Water
Solutions for LeetCode 42, hard, tags: array, two pointers, dynamic programming, stack, monotonic stack.
-
LeetCode 152 Maximum Product Subarray
Solutions for LeetCode 152, medium, tags: array, dynamic programming.
-
LeetCode 1848 Minimum Distance to the Target Element
Solutions for LeetCode 1848, easy, tags: array.
-
LeetCode 394 Decode String
Solutions for LeetCode 394, medium, tags: string, stack, recursion.
-
LeetCode 56 Merge Intervals
Solutions for LeetCode 56, medium, tags: array, sorting.
-
LeetCode 215 Kth Largest Element in an Array
Solutions for LeetCode 215, medium, tags: array, divide and conquer, sorting, heap, quick select.
-
LeetCode 200 Number of Islands
Solutions for LeetCode 200, medium, tags: array, depth-first search, breadth-first search, union find, matrix.
-
LeetCode 739 Daily Temperatures
Solutions for LeetCode 739, medium, tags: array, stack, monotonic stack.
-
LeetCode 3 Longest Substring Without Repeating Characters
Solutions for LeetCode 3, medium, tags: hash table, string, sliding window.
-
LeetCode 378 LintCode 1272 Kth Smallest Element in a Sorted Matrix
Solutions for LeetCode 378 and LintCode 1272, medium, tags: array, binary search, heap, matrix.
Recent Posts
-
System Design - How Bloom Filters Work
How Bloom filters work: the probabilistic data structure behind fast membership testing in databases, with a source code walkthrough of LevelDB and RocksDB implementations.
-
System Design - How Skip Lists Work
How skip lists work: the probabilistic data structure behind Redis sorted sets, LevelDB memtables, and Java's ConcurrentSkipListMap. Covers the layered linked-list architecture, search/insert/delete algorithms, probabilistic balancing, and real-world source code walkthrough.
-
System Design - How MVCC (Multi-Version Concurrency Control) Works
How MVCC works in databases: the concurrency problem it solves, snapshot isolation, PostgreSQL's tuple versioning with xmin/xmax, MySQL InnoDB's undo log and ReadView, garbage collection, and source code walkthrough.
-
System Design - Kubernetes Pod Scheduling, Custom Schedulers, and Karpenter
How Kubernetes schedules pods: the default kube-scheduler's filter-score pipeline, the scheduling framework's extension points, custom schedulers (TiDB scheduler as case study), and how Karpenter complements scheduling by provisioning nodes.
-
System Design - Local Kubernetes with k3d for Development
How to set up a local Kubernetes cluster with k3d for development: cluster creation, port mapping with NodePort, Mac vs Linux access patterns, kubectl port-forward vs NodePort, and why ctr digest errors are harmless.
-
System Design - How B+ Trees Power Every Database Index
How B+ trees work: node structure, search, insertion with splits, deletion with merges, disk I/O optimization, and why virtually every relational database uses them for indexing.
-
System Design - How Write-Ahead Logging (WAL) Works
How Write-Ahead Logging (WAL) works: the core protocol behind database durability and crash recovery. Covers the WAL principle, record structure, buffer management, checkpoints, crash recovery, and a source code walkthrough from PostgreSQL.
-
System Design - How LSM Trees Work (The Engine Behind RocksDB, LevelDB, and Cassandra)
How Log-Structured Merge Trees (LSM Trees) work: the write-optimized data structure behind RocksDB, LevelDB, Cassandra, and TiKV. Covers memtable, WAL, SSTables, compaction strategies, bloom filters, and a source code walkthrough from the facebook/rocksdb repository.