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 1696 Jump Game VI
Solutions for LeetCode 1696, medium, tags: array, dynamic programming, sliding window, monotonic queue, heap.
-
LeetCode 2419 Longest Subarray With Maximum Bitwise AND
Solution for LeetCode 2419, medium, tags: array, bit manipulation.
-
LeetCode 1480 Running Sum of 1d Array
Solutions for LeetCode 1480, easy, tags: array, prefix sum.
-
LeetCode 2053 Kth Distinct String in an Array
Solutions for LeetCode 2053, easy, tags: array, hash table, string.
-
LeetCode 1493 Longest Subarray of 1's After Deleting One Element
Solutions for LeetCode 1493, medium, tags: array, sliding window, prefix sum.
-
LeetCode 1207 Unique Number of Occurrences
Solutions for LeetCode 1207, easy, tags: array, hash table.
-
LeetCode 2352 Equal Row and Column Pairs
Solutions for LeetCode 2352, medium, tags: array, hash table, matrix.
-
LeetCode 1827 Minimum Operations to Make the Array Increasing
Solution for LeetCode 1827, easy, tags: array, greedy. One pass in Java, Python, C++, and Rust.
-
LeetCode 2530 Maximal Score After Applying K Operations
Solution for LeetCode 2530, medium, tags: array, greedy, heap (priority queue).
-
LeetCode 1129 Shortest Path with Alternating Colors
Solutions for LeetCode 1129, medium, tags: graph, breadth-first search.
Recent Posts
-
System Design - How TiDB's Selection Executor Filters Chunks
Trace a root Selection from PhysicalSelection through executorBuilder and SelectionExec to a vectorized filter, including its row-at-a-time fallback and chunk controls.
-
System Design - How TLS Certificate Revocation Reaches a Browser
Follow a compromised TLS certificate from CA revocation through CRLs and OCSP to browser checks, and see why freshness and privacy complicate the design.
-
System Design - How TiDB's LIMIT Executor Reads Only Enough Rows
Trace LIMIT with OFFSET through TiDB's PhysicalLimit, executorBuilder, LimitExec, and Chunk, including how chunk demand and session settings affect reads.
-
System Design - How Kubernetes Horizontal Pod Autoscaling Works
Follow a traffic spike through Kubernetes' HPA control loop: metric collection, replica calculations, the scale subresource, and the safeguards against noisy measurements.
-
System Design - How a TCP Connection Opens and Closes
Follow one TCP connection from SYN to TIME-WAIT: sequence numbers, the three-way handshake, half-close, FIN versus RST, and why the active closer lingers.
-
System Design - How TiDB Writes and Reads Its Slow Query Log
A source-level tour of TiDB's slow SQL path: ExecStmt's duration gate, SlowQueryLogItems formatting, the file logger, and the SLOW_QUERY virtual table.
-
System Design - How Apache Airflow Schedules a DAG
A beginner-friendly explanation of Apache Airflow's DAG processor, scheduler, executor, and workers—and how a task becomes eligible to run.
-
System Design - How TiDB Locks Rows for SELECT FOR UPDATE
Trace a pessimistic SELECT FOR UPDATE from TiDB's executor through the TiKV MVCC lock command, including lock waits, timestamp conflicts, and the settings that control them.