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 442 Find All Duplicates in an Array
Solutions for LeetCode 442, medium, tags: array, hash table.
-
LeetCode 930 Binary Subarrays With Sum
Solutions for LeetCode 930, medium, tags: array, hash table, sliding window, prefix sum.
-
LeetCode 2962 Count Subarrays Where Max Element Appears at Least K Times
Solutions for LeetCode 2962, medium, tags: array, sliding window, binary search.
-
LeetCode 338 Counting Bits
Solutions for LeetCode 338, easy, tags: dynamic programming, bit manipulation.
-
LeetCode 211 Design Add and Search Words Data Structure
Solutions for LeetCode 211, medium, tags: string, depth-first search, design, trie.
-
LeetCode 974 Subarray Sums Divisible by K
Solutions for LeetCode 974, medium, tags: array, hash table, prefix sum.
-
LeetCode 572 Subtree of Another Tree
Solutions for LeetCode 572, easy, tags: tree, dfs, string matching, binary tree, hash function.
-
LeetCode 904 Fruit Into Baskets
Solutions for LeetCode 904, medium, tags: array, hash table, sliding window.
-
LeetCode 224 Basic Calculator
Solutions for LeetCode 224, hard, tags: math, string, stack, recursion.
-
LeetCode 32 Longest Valid Parentheses
Solutions for LeetCode 32, hard, tags: string, stack, dynamic programming.
Recent Posts
-
System Design - How Database Vacuum and Garbage Collection Works
How PostgreSQL's VACUUM and garbage collection works: why MVCC creates dead tuples, the lazy vacuum and full vacuum algorithms, visibility maps, freeze maps, transaction ID wraparound, and autovacuum tuning — with source code walkthrough.
-
System Design - How Distributed Stream Processing Works (Apache Flink)
How distributed stream processing works: dataflow graphs, event time vs processing time, windowing, watermarks, state management, checkpointing, and exactly-once semantics — with source code walkthrough from Apache Flink.
-
System Design - How Regex Engines Work
How regex engines work under the hood: Thompson's NFA construction, NFA-to-DFA conversion, backtracking, and how real implementations like RE2 and PCRE differ in their approach to matching.
-
System Design - How Compilers Turn Source Code into Machine Code
How compilers work: the full pipeline from source code to executable — lexing, parsing, AST construction, semantic analysis, intermediate representation, optimization passes, and code generation, with source code examples from real compilers.
-
LeetCode 234 Palindrome Linked List
Solutions for LeetCode 234, easy, tags: linked list, two pointers, stack, recursion.
-
LeetCode 96 Unique Binary Search Trees
Solutions for LeetCode 96, medium, tags: math, dynamic programming, tree, binary search tree.
-
AI/ML - How Neural Network Backpropagation Works
How backpropagation trains neural networks: the chain rule on computational graphs, forward pass, backward pass, gradient flow, vanishing gradients, and a source code walkthrough of PyTorch's autograd engine.
-
LeetCode 1679 Max Number of K-Sum Pairs
Solutions for LeetCode 1679, medium, tags: array, hash table, two pointers, sorting.