LeetCode MEDIUM 146 LRU Cache Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: LRU Cache
  • Main tags: Hash Table, Linked List, Design, Doubly-Linked List

What the problem is really asking

This problem is not mainly about storing key-value pairs. It is about building a data structure that can answer two different questions at the same time:

Continue ...

LeetCode MEDIUM 162 Find Peak Element Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

This problem does not ask for the maximum value in the whole array.

It only asks for any index whose value is greater than its neighbors. That is a much weaker requirement, and that weaker requirement is exactly what makes the binary-search solution possible.

Continue ...

LeetCode MEDIUM 238 Product of Array Except Self Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

For each index, the answer should be the product of every number except the one currently sitting at that index.

If the input is [1, 2, 3, 4], then:

Continue ...

LeetCode MEDIUM 424 Longest Repeating Character Replacement Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input is a string and a budget k. One operation lets us replace any single character with any other character. The goal is to find the longest substring that can be turned into a string of all one repeated character using at most k replacements.

Continue ...

System Design TinyURL Summary

Generated by Codex with gpt-5

Selected problem: TinyURL

Scope: Design a highly available URL shortening service that creates compact aliases, resolves them with very low latency, and records click analytics without putting the redirect path at risk.

Also see https://wiki.derricklin.net/software-development/System%20Design%20Interview/#url-shortener

Problem framing

This is the classic URL shortener problem: map a short code to a long URL, make redirects fast, and survive a very read-heavy workload with occasional viral hot keys.

Continue ...

LeetCode HARD 1944 Number of Visible People in a Queue Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

Each person is looking to the right. For every position, the task is to count how many people are visible before the view is blocked.

Continue ...

LeetCode HARD 354 Russian Doll Envelopes Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

Each envelope has a width and a height. One envelope can go inside another only if both dimensions are strictly smaller.

So the real question is:

Continue ...

LeetCode MEDIUM 167 Two Sum II - Input Array Is Sorted Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input array is already sorted in non-decreasing order, and the goal is to find the two numbers whose sum equals the target.

Continue ...

LeetCode MEDIUM 200 Number of Islands Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Number of Islands
  • Main tags: Array, Depth-First Search, Breadth-First Search, Union-Find, Matrix

What the problem is really asking

The grid is a map of water and land:

  • "1" means land
  • "0" means water

An island is one connected piece of land using only the four cardinal directions: up, down, left, and right.

Continue ...

LeetCode MEDIUM 215 Kth Largest Element in an Array Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

This problem asks for the value that would appear in position k if the array were sorted in descending order.

Continue ...