LeetCode HARD 135 Candy Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: HARD
  • Problem: Candy
  • Main tags: Array, Greedy

What the problem is really asking

There are children standing in a line. Each child has a rating, and the goal is to give out the fewest total candies while obeying two rules:

  • every child gets at least one candy
  • any child with a higher rating than an adjacent child must get more candies than that neighbor

The important detail is that the comparison is only between neighbors. A child does not need more candy than every lower-rated child, only more than the children immediately to the left and right when their rating is higher.

Continue ...

LeetCode HARD 329 Longest Increasing Path in a Matrix Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input is a grid of numbers. From any cell, a path may move only up, down, left, or right, and each move must go to a strictly larger value. The task is to return the maximum number of cells that can appear in any such path.

Continue ...

LeetCode MEDIUM 131 Palindrome Partitioning Summary

Generated by Codex with GPT-5

Difficulty: MEDIUM
Problem: Palindrome Partitioning

Problem gist

The input is a string s. The task is to return every possible way to split s into non-empty substrings such that every chosen substring is a palindrome.

For example, "aab" can be split as ["a", "a", "b"] or ["aa", "b"]. Both are valid because every piece reads the same forward and backward. A split like ["a", "ab"] is invalid because "ab" is not a palindrome.

Continue ...

LeetCode MEDIUM 636 Exclusive Time of Functions Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

The input describes calls on a single-threaded CPU. Each log entry has a function id, an event type, and a timestamp:

function_id:start_or_end:timestamp

A function can call another function before it finishes. While the child function runs, the parent is paused. The goal is to return, for every function id, how much time that function spent actually executing, excluding time spent inside child calls.

Continue ...

LeetCode HARD 843 Guess the Word Summary

Generated by Codex with GPT-5

Difficulty: HARD

Problem: Guess the Word

Problem gist

This is an interactive guessing problem. There is a hidden six-letter word inside the given list, and the only way to learn about it is to call master.guess(word). The API returns how many positions match the secret exactly. For example, if the guess and secret have the same letter in positions 0, 2, and 5, the response is 3.

Continue ...

LeetCode MEDIUM 79 Word Search Summary

Generated by Codex with GPT-5

Difficulty: MEDIUM

Problem: Word Search

Problem gist

The problem gives a 2D grid of characters and a target word. The task is to decide whether the word can be formed by walking through adjacent grid cells. Each step may move up, down, left, or right, and the same cell cannot be used twice in the same word path.

Continue ...

LeetCode MEDIUM 80 Remove Duplicates from Sorted Array II Summary

Generated by Codex with GPT-5

Difficulty: MEDIUM

Problem: Remove Duplicates from Sorted Array II

Problem gist

The input is a sorted array nums. The task is to modify it in place so every distinct value appears at most two times, while keeping the original relative order of the remaining values. The function returns k, the length of the valid prefix. Anything after index k - 1 does not matter.

Continue ...

LeetCode MEDIUM 974 Subarray Sums Divisible by K Summary

Generated by Codex with GPT-5

Quick facts

What the problem is asking

Given an integer array nums and an integer k, count how many contiguous subarrays have a sum divisible by k.

The word “contiguous” is the key constraint. A valid answer must count ranges like nums[left:right + 1], not arbitrary subsets. The same element can participate in many different subarrays, and overlapping ranges are counted separately.

Continue ...

LeetCode MEDIUM 1101 The Earliest Moment When Everyone Become Friends Summary

Generated by Codex with GPT-5

Quick facts

What the problem is really asking

There are n people labeled from 0 to n - 1. The input is a list of friendship events. Each event has a timestamp and two people, meaning those two people become direct friends at that moment.

Continue ...

LeetCode MEDIUM 210 Course Schedule II Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Course Schedule II
  • 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 [course, prerequisite] means the prerequisite must be taken before the course. The task is to return any valid order that takes every course, or return an empty list when no such order exists.

Continue ...