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 189 Rotate Array
Solutions for LeetCode 189, medium, tags: array, math, two pointers.
-
LeetCode 1202 Smallest String With Swaps
Solutions for LeetCode 1202, medium, tags: array, hash table, string, depth-first search, breadth-first search, union find, sorting.
-
LeetCode 395 Longest Substring with At Least K Repeating Characters
Solutions for LeetCode 395, medium, tags: hash table, string, divide and conquer, sliding window.
-
LeetCode 241 Different Ways to Add Parentheses
Solutions for LeetCode 241, medium, tags: math, dynamic programming, string, recursion, memoization.
-
LeetCode 1448 Count Good Nodes in Binary Tree
Solutions for LeetCode 1448, medium, tags: tree, depth-first search, breadth-first search, binary tree.
-
LeetCode 503 Next Greater Element II
Solutions for LeetCode 503, medium, tags: array, stack, monotonic stack.
-
LeetCode 542 01 Matrix
Solutions for LeetCode 542, medium, tags: array, dynamic programming, bfs, matrix.
-
LeetCode 377 Combination Sum IV
Solutions for LeetCode 377, medium, tags: array, dynamic programming.
-
LeetCode 2439 Minimize Maximum of Array
Solutions for LeetCode 2439, medium, tags: array, binary search, greedy, prefix sum.
-
LeetCode 226 Invert Binary Tree
Solutions for LeetCode 226, easy, tags: tree, depth-first search, breadth-first search, binary tree.
Recent Posts
-
AI/ML - How Reinforcement Learning from Human Feedback (RLHF) Works
How RLHF works end to end: supervised fine-tuning, reward model training, PPO optimization, and the math behind aligning large language models with human preferences.
-
System Design - How Debuggers Work
How debuggers like GDB and LLDB work under the hood: ptrace system call, INT3 software breakpoints, hardware watchpoints, single-stepping, DWARF debug info, and source code walkthrough from the GDB and Linux kernel.
-
System Design - How SQLite Works Internally
How SQLite works internally: the tokenizer, parser, bytecode compiler, virtual machine (VDBE), B-tree storage engine, pager, and WAL — a complete walkthrough of how a SQL statement travels from text to disk in the world's most deployed database.
-
System Design - How Linux Signals Work
How Linux signals work: signal delivery from kernel to userspace, signal dispositions, the sigaction machinery, signal masks, real-time vs standard signals, and a source code walkthrough of the Linux kernel signal path.
-
System Design - How Diff Algorithms Work
How diff algorithms work: the edit graph model, shortest edit script, Myers' O(ND) algorithm with greedy snakes and D-contours, git's diff strategies (Myers, patience, histogram), and a source code walkthrough of xdiff in the git codebase.
-
System Design - How Floating Point Arithmetic Works (IEEE 754)
How IEEE 754 floating point works: the sign-exponent-mantissa bit layout, normalization, special values (infinity, NaN, denormals), rounding modes, and why 0.1 + 0.2 != 0.3 — with binary walkthroughs and real source code.
-
LeetCode 451 Sort Characters By Frequency
Solutions for LeetCode 451, medium, tags: hash table, string, sorting, heap, bucket sort.
-
System Design - How Hardware Interrupts and Trap Handling Work
How hardware interrupts work: the interrupt lifecycle from electrical signal to handler execution, IDT, IRQs, top-half/bottom-half processing, and a Linux kernel source code walkthrough.