LeetCode MEDIUM 221 Maximal Square Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Maximal Square
  • Main tags: Array, Dynamic Programming, Matrix

What the problem is really asking

The input is a grid of "0" and "1" values. The job is to find the area of the largest square made entirely of 1s.

The part that usually traps people is the word “square.” A brute-force approach tends to ask:

Continue ...

LeetCode MEDIUM 994 Rotting Oranges Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Rotting Oranges
  • Main tags: Array, Breadth-First Search, Matrix

Problem gist

The grid has three kinds of cells: empty (0), fresh oranges (1), and rotten oranges (2). Every minute, any fresh orange touching a rotten orange in the four main directions also becomes rotten.

Continue ...

LeetCode HARD 410 Split Array Largest Sum Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: HARD
  • Problem: Split Array Largest Sum
  • Main tags: Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum

What the problem is really asking

The input array must be cut into exactly k non-empty, contiguous pieces. Each cut creates one subarray, and the score of a split is the largest subarray sum that appears anywhere in that split.

Continue ...

LeetCode MEDIUM 540 Single Element in a Sorted Array Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The array is sorted, and every value appears exactly twice except for one value that appears once.

If the array were not sorted, the quickest idea would be XOR: identical values cancel out, so the final XOR is the answer. That works in O(n) time and O(1) space.

Continue ...

LeetCode MEDIUM 912 Sort an Array Summary

Generated by Codex with GPT-5.4

Difficulty: MEDIUM
Problem: Sort an Array

Problem gist

The task is deliberately simple to state: given an integer array, return the same values in ascending order. The interview signal is not whether someone knows Python’s built-in sort, but whether they can implement a sorting strategy with clear time and space guarantees.

Continue ...

LeetCode HARD 85 Maximal Rectangle Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: HARD
  • Problem: Maximal Rectangle
  • Main tags: Array, Dynamic Programming, Stack, Matrix, Monotonic Stack

What the problem is really asking

The matrix contains only "0" and "1", and the goal is to find the area of the largest axis-aligned rectangle made entirely of "1" cells.

Continue ...

LeetCode MEDIUM 189 Rotate Array Summary

Generated by Codex with GPT-5.4

Quick facts

  • Difficulty: MEDIUM
  • Problem: Rotate Array
  • Main tags: Array, Math, Two Pointers

What the problem is really asking

The problem gives an array nums and an integer k. The task is to rotate the array to the right by k positions, modifying the original list in place.

Continue ...

LeetCode MEDIUM 207 Course Schedule Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Course Schedule
  • Main tags: Depth-First Search, Breadth-First Search, Graph Theory, Topological Sort

What the problem is really asking

There are numCourses courses labeled from 0 to numCourses - 1.

Each prerequisite pair [a, b] means course b must be finished before course a.

Continue ...

LeetCode MEDIUM 78 Subsets Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Subsets
  • Main tags: Array, Backtracking, Bit Manipulation

What the problem is really asking

Given an array nums of distinct integers, return every possible subset of those numbers.

A subset can contain none of the numbers, some of the numbers, or all of the numbers. The empty subset [] is valid, and the full array is valid too. Because the input numbers are distinct, there is no duplicate-handling problem in the base version.

Continue ...

LeetCode HARD 84 Largest Rectangle in Histogram Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

Each bar in the histogram has width 1, and the goal is to find the largest possible rectangle that can be formed by taking one or more adjacent bars.

Continue ...