LeetCode MEDIUM 150 Evaluate Reverse Polish Notation Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

Reverse Polish Notation writes an arithmetic expression so that every operator comes after the two values it uses. Instead of writing 2 + 3, it writes 2 3 +. This removes parentheses because the order is encoded directly in the token stream.

Continue ...

LeetCode MEDIUM 134 Gas Station Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Gas Station
  • Topics: Array, Greedy

Problem gist

There are n gas stations arranged in a circle. Station i provides gas[i] units of fuel, and driving from station i to the next station costs cost[i] units. The car starts with an empty tank. The task is to return an index from which the car can complete one full clockwise circuit, or -1 if no such index exists.

Continue ...

LeetCode MEDIUM 133 Clone Graph Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Clone Graph
  • Topics: Hash Table, Depth-First Search, Breadth-First Search, Graph Theory

Problem gist

The input is a reference to one node in a connected, undirected graph. Each node stores a value and a list of neighboring nodes. The goal is to return a deep copy of the entire graph: every original node must have a newly created counterpart, and every edge must connect the corresponding copied nodes.

Continue ...

LeetCode MEDIUM 120 Triangle Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: MEDIUM
  • Problem: Triangle
  • Topics: Array, Dynamic Programming

Problem gist

The input is a triangle of numbers. A path starts at the top and moves down one row at a time. From position (row, column), the next value must be either directly below at (row + 1, column) or diagonally below-right at (row + 1, column + 1).

Continue ...

LeetCode MEDIUM 71 Simplify Path Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

The task is to turn a Unix-style absolute path into its canonical form. A canonical path always starts with one slash, uses one slash between directory names, has no trailing slash unless the path is the root, and removes navigation tokens that do not represent real directory names.

Continue ...

LeetCode MEDIUM 98 Validate Binary Search Tree Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

Given the root of a binary tree, decide whether the tree is a valid binary search tree.

The important detail is that the BST rule is global, not just local. A node in the left subtree must be smaller than the root, not merely smaller than its parent. A node in the right subtree must be larger than the root, not merely larger than its parent. The same rule repeats at every node.

Continue ...

LeetCode MEDIUM 43 Multiply Strings Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

Given two non-negative integers as strings, return their product as a string. The catch is that the inputs may be too large for normal integer conversion, so the solution has to work with characters and digits directly.

Continue ...

LeetCode HARD 1044 Longest Duplicate Substring Summary

Generated by Codex with GPT-5

Quick facts

  • Difficulty: HARD
  • Problem: Longest Duplicate Substring
  • Topics: String, Binary Search, Sliding Window, Rolling Hash, Suffix Array, Hash Function

Problem gist

Given a string s, the task is to return any longest substring that appears at least twice in s. The two occurrences may overlap. For example, in banana, the answer is ana, because ana appears starting at index 1 and again at index 3.

Continue ...

LeetCode MEDIUM 2149 Rearrange Array Elements by Sign Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

The input is an even-length array with exactly the same number of positive and negative integers. The task is to return a new ordering that starts with a positive number, alternates signs at every index, and keeps the relative order of the positive numbers and the relative order of the negative numbers.

Continue ...

LeetCode MEDIUM 1922 Count Good Numbers Summary

Generated by Codex with GPT-5

Quick facts

Problem gist

The problem asks for the number of length-n digit strings that satisfy two position rules:

  • Digits at even indices can be one of 0, 2, 4, 6, or 8.
  • Digits at odd indices can be one of 2, 3, 5, or 7.

Indices are zero-based, so index 0 is even. The string can start with 0; this is a digit string, not a normal integer representation. Because the answer can be enormous, return it modulo 1_000_000_007.

Continue ...