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 230 Kth Smallest Element in a BST
Solutions for LeetCode 230, medium, tags: tree, depth-first search, binary search tree, binary tree.
-
LeetCode 347 Top K Frequent Elements
Solutions for LeetCode 347, medium, tags: array, hash table, divide and conquer, sorting, heap, bucket sort, counting, quickselect.
-
LeetCode 49 Group Anagrams
Solutions for LeetCode 49, medium, tags: array, hash table, string, sorting.
-
LeetCode 238 Product of Array Except Self
Solutions for LeetCode 238, medium, tags: array, prefix sum.
-
LeetCode 560 Subarray Sum Equals K
Solutions for LeetCode 560, medium, tags: array, hash table, prefix sum.
-
LeetCode 76 Minimum Window Substring
Solutions for LeetCode 76, hard, tags: hash table, string, sliding window.
-
LeetCode 416 Partition Equal Subset Sum
Solutions for LeetCode 416, medium, tags: array, dynamic programming, bit manipulation.
-
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.
Recent Posts
-
AI/ML - How the Transformer Attention Mechanism Works
How the Transformer attention mechanism works: intuition behind queries/keys/values, scaled dot-product attention, multi-head attention, positional encoding, and a source code walkthrough from PyTorch and the original paper.
-
System Design - How the TLS Handshake Works
How TLS (Transport Layer Security) works: the handshake protocol, certificate verification, key exchange with Diffie-Hellman, symmetric encryption, TLS 1.2 vs 1.3, and a source code walkthrough from Go's crypto/tls package.
-
System Design - How Apache Kafka Works
How Apache Kafka works internally: the distributed commit log, partitions, replication with ISR, producer batching, consumer groups, zero-copy transfer, and source code walkthrough from the apache/kafka repository.
-
System Design - How gRPC Works
How gRPC works under the hood: Protocol Buffers serialization, HTTP/2 framing, the four RPC patterns (unary, server streaming, client streaming, bidirectional), channel and transport architecture, interceptors, and a source code walkthrough from the grpc/grpc-go repository.
-
System Design - How Garbage Collection Works
How garbage collection works in practice: reference counting vs. tracing, mark-and-sweep fundamentals, tri-color marking, Go's concurrent collector, write barriers, GC pacing, and source code walkthrough from the Go runtime.
-
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.