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 73 Set Matrix Zeroes
Solutions for LeetCode 73, medium, tags: array, hash table, matrix.
-
LeetCode 516 Longest Palindromic Subsequence
Solutions for LeetCode 516, medium, tags: string, dynamic programming.
-
LeetCode 380 Insert Delete GetRandom O(1)
Solutions for LeetCode 380, medium, tags: array, hash table, math, design, randomized.
-
LeetCode 297 Serialize and Deserialize Binary Tree
Solutions for LeetCode 297, hard, tags: string, tree, binary tree, design, dfs, bfs.
-
LeetCode 34 Find First and Last Position of Element in Sorted Array
Solutions for LeetCode 34, medium, tags: array, binary search.
-
LeetCode 102 Binary Tree Level Order Traversal
Solutions for LeetCode 102, medium, tags: tree, breadth-first search, depth-first search, binary tree.
-
LeetCode 402 Remove K Digits
Solutions for LeetCode 402, medium, tags: string, stack, monotonic stack, greedy.
-
LeetCode 684 Redundant Connection
Solutions for LeetCode 684, medium, tags: tree, union find, graph, depth-first search.
-
LeetCode 525 Contiguous Array
Solutions for LeetCode 525, medium, tags: array, hash table, prefix sum.
-
LeetCode 567 Permutation in String
Solutions for LeetCode 567, medium, tags: hash table, two pointers, string, sliding window.
Recent Posts
-
System Design - How Merkle Trees Work
How Merkle trees work: hash tree structure, efficient data verification, applications in git, blockchains, distributed databases (Cassandra, DynamoDB), and certificate transparency.
-
System Design - How Vectorized Query Execution Works
How vectorized query execution works in modern databases: the Volcano model's limitations, batch-at-a-time processing, columnar memory layout, SIMD exploitation, and source code walkthrough from DuckDB and Apache DataFusion.
-
System Design - How Raft Consensus Works
How the Raft consensus algorithm works: leader election, log replication, safety guarantees, membership changes, and a source code walkthrough from etcd's raft library.
-
System Design - How Lock-Free Data Structures Work
How lock-free data structures work: CAS operations, memory ordering, the ABA problem, lock-free stacks and queues, and source code walkthrough from the Linux kernel and Java's java.util.concurrent.
-
LeetCode 1249 Minimum Remove to Make Valid Parentheses
Solutions for LeetCode 1249, medium, tags: string, stack.
-
System Design - How Zero-Copy I/O Works
How zero-copy I/O works in Linux: the cost of traditional read/write, how sendfile() and splice() eliminate copies, how mmap fits in, and why Kafka and nginx are fast — with ASCII diagrams and kernel source code references.
-
LeetCode 438 Find All Anagrams in a String
Solutions for LeetCode 438, medium, tags: hash table, string, sliding window.
-
LeetCode 153 Find Minimum in Rotated Sorted Array
Solutions for LeetCode 153, medium, tags: array, binary search.