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 2602 Minimum Operations to Make All Array Elements Equal
Solutions for LeetCode 2602, medium, tags: array, binary search, sorting, prefix sum.
-
LeetCode 2730 Find the Longest Semi-Repetitive Substring
Solutions for LeetCode 2730, medium, tags: string, sliding window, two pointers.
-
LeetCode 3066 Minimum Operations to Exceed Threshold Value II
A min-heap simulation that repeatedly combines the two smallest values, with overflow-safe implementations in four languages.
-
LeetCode 945 Minimum Increment to Make Array Unique
Solutions for LeetCode 945, medium, tags: array, greedy, sorting, counting.
-
LeetCode 1094 Car Pooling
Solutions for LeetCode 1094, medium, tags: array, sorting, heap, simulation, prefix sum.
-
LeetCode 289 Game of Life
Solutions for LeetCode 289, medium, tags: array, matrix, simulation.
-
LeetCode 983 Minimum Cost For Tickets
Solutions for LeetCode 983, medium, tags: dynamic programming.
-
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.
Recent Posts
-
System Design - How TiDB Point Get Works
Trace a TiDB Point_Get query from planner eligibility through PointGetExecutor to TiKV's snapshot Get, with source links, diagnostics, and relevant controls.
-
System Design - How WebAuthn Passkeys Work
A beginner-friendly walkthrough of passkey registration and sign-in, including WebAuthn challenges, public-key signatures, phishing resistance, and device sync.
-
System Design - How Apache Iceberg Works
A beginner-friendly walkthrough of Apache Iceberg's catalog, metadata, snapshots, manifests, file pruning, commits, and the trade-offs of building reliable tables on object storage.
-
System Design - How TiDB Index Lookup Pushdown Works
A source-code walkthrough of TiDB's double-read IndexLookUp plan, how TiDB and TiKV cooperate to push local row lookups down, and the policy, hint, and affinity settings that control it.
-
AI/ML - How the LLM KV Cache Works
How the LLM key-value cache speeds up token-by-token generation, what it stores, why it consumes GPU memory, and how paged allocation helps serving systems.
-
System Design - How Unicode and UTF-8 Encoding Work
How Unicode and UTF-8 encoding work: the journey from ASCII to a universal character set, UTF-8's variable-length encoding scheme, byte structure, self-synchronization, and why it became the dominant encoding on the web.
-
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.