#Leetcode

LeetCode HARD 42 Trapping Rain Water Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: HARD
  • Problem: Trapping Rain Water
  • Main tags: Array, Two Pointers, Dynamic Programming, Stack

What the problem is really asking

The input is an elevation map where each number is the height of a vertical bar with width 1.

After rain falls, water can sit in the valleys between taller bars. The task is to compute the total amount of water that stays trapped.

Continue ...

LeetCode MEDIUM 11 Container With Most Water Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input is an array of heights. Each height represents a vertical line drawn at that index.

The task is to pick two lines that, together with the x-axis, form a container that holds the most water.

Continue ...

LeetCode MEDIUM 2 Add Two Numbers Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Add Two Numbers
  • Main tags: Linked List, Math, Recursion

What the problem is really asking

Two linked lists represent two non-negative integers. Each node stores one digit, and the digits are already in reverse order, so the ones place comes first.

Continue ...

LeetCode MEDIUM 3 Longest Substring Without Repeating Characters Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

Given a string, the goal is to find the length of the longest contiguous block of characters with no repeats.

The important word is contiguous. This is not asking for a subsequence that can skip characters. It is asking for one unbroken window inside the string.

Continue ...

LeetCode MEDIUM 5 Longest Palindromic Substring Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

Given a string, return the longest contiguous substring that reads the same forward and backward.

The word “substring” is the important constraint. This is not about picking scattered characters. The answer has to be one continuous block inside the original string.

Continue ...

LeetCode MEDIUM 560 Subarray Sum Equals K Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input is an integer array and a target k.

The task is not to find the longest subarray or to return the subarray itself. It is simply to count how many contiguous subarrays add up to k.

Continue ...