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 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.
-
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.
-
LeetCode 1679 Max Number of K-Sum Pairs
Solutions for LeetCode 1679, medium, tags: array, hash table, two pointers, sorting.
-
LeetCode 802 Find Eventual Safe States
Solutions for LeetCode 802, medium, tags: depth-first search, breadth-first search, graph, topological sort.
Recent Posts
-
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.
-
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.
-
System Design - How the Linux Boot Process Works
How a Linux machine boots: from pressing the power button through firmware (BIOS/UEFI), bootloader (GRUB2), kernel decompression, the init process, and systemd — with source code walkthrough from the Linux kernel.
-
LeetCode 692 Top K Frequent Words
Solutions for LeetCode 692, medium, tags: hash table, string, trie, sorting, heap, bucket sort, counting.
-
System Design - How the ELF Binary Format and Program Loading Work
How the ELF binary format works on Linux: file structure, headers, sections vs segments, how the kernel loads a program via execve and load_elf_binary, dynamic linking with PLT/GOT, and the journey from ./a.out to the first instruction.
-
LeetCode 1004 Max Consecutive Ones III
Solutions for LeetCode 1004, medium, tags: array, binary search, sliding window, prefix sum.
-
LeetCode 662 Maximum Width of Binary Tree
Solutions for LeetCode 662, medium, tags: tree, depth-first search, breadth-first search, binary tree.