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 2542 Maximum Subsequence Score
Solutions for LeetCode 2542, medium, tags: array, greedy, sorting, heap (priority queue).
-
LeetCode 150 Evaluate Reverse Polish Notation
Solutions for LeetCode 150, medium, tags: array, math, stack.
-
LeetCode 55 Jump Game
Solutions for LeetCode 55, medium, tags: array, dynamic programming, greedy.
-
LeetCode 71 Simplify Path
Solutions for LeetCode 71, medium, tags: string, stack.
-
LeetCode 31 Next Permutation
Solutions for LeetCode 31, medium, tags: array, two pointers.
-
LeetCode 57 Insert Interval
Solutions for LeetCode 57, medium, tags: array.
-
LeetCode 695 Max Area of Island
Solutions for LeetCode 695, medium, tags: array, depth-first search, breadth-first search, union find, matrix.
-
LeetCode 115 Distinct Subsequences
Solutions for LeetCode 115, hard, tags: string, dynamic programming.
-
LeetCode 73 Set Matrix Zeroes
Solutions for LeetCode 73, medium, tags: array, hash table, matrix.
-
LeetCode 98 Validate Binary Search Tree
Solutions for LeetCode 98, medium, tags: tree, depth-first search, binary search tree, binary tree.
Recent Posts
-
System Design - How Database Deadlock Detection Works
How databases detect deadlocks: the wait-for graph algorithm, cycle detection via DFS, InnoDB's implementation, victim selection strategies, and how distributed databases like TiDB handle cross-node deadlocks.
-
System Design - How SSDs Work Internally (NAND Flash, FTL, and Write Amplification)
How Solid-State Drives work internally: NAND flash physics, pages and blocks, the Flash Translation Layer (FTL), garbage collection, wear leveling, write amplification, TRIM, and why understanding SSDs matters for database engineers.
-
System Design - How CPU Branch Prediction Works
How modern CPUs predict branch outcomes: pipeline stalls, static vs dynamic prediction, branch history tables, two-level adaptive predictors, branch target buffers, and real-world performance implications with code examples.
-
System Design - How JIT (Just-In-Time) Compilation Works
How JIT compilation works: interpreter warm-up, profiling, tiered compilation in the JVM HotSpot and V8 engines, inline caches, deoptimization, and source code walkthrough.
-
System Design - How the Linux Page Cache Works
How the Linux page cache works: the kernel's transparent caching layer that sits between applications and disk. Covers address_space, radix tree (xarray), readahead, dirty page writeback, memory pressure eviction, and source code walkthrough from the Linux kernel.
-
System Design - How Prometheus TSDB (Time-Series Database) Works
How Prometheus stores time-series data: the in-memory head block, Write-Ahead Log, chunk encoding, compaction into persistent blocks, and how queries traverse the layered architecture. Source code walkthrough from the prometheus/prometheus repository.
-
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.