LeetCode MEDIUM 373 Find K Pairs with Smallest Sums Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Two sorted integer arrays are given. A pair is formed by choosing one value from the first array and one from the second, and its cost is their sum. The task is to return the k pairs with the smallest costs, or every possible pair when fewer than k pairs exist.

Continue ...

LeetCode MEDIUM 337 House Robber III Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

  • Difficulty: MEDIUM
  • Problem: House Robber III
  • Topics: Dynamic Programming, Tree, Depth-First Search, Binary Tree

Problem gist

Each node in a binary tree represents a house, and its value is the amount of money in that house. Robbing two houses connected by an edge triggers the alarm, so a robbed node rules out its parent and its immediate children. The goal is to choose a valid set of nodes with the largest possible total value.

Continue ...

LeetCode MEDIUM 328 Odd Even Linked List Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Given a singly linked list, rearrange its existing nodes so that every node in an odd-numbered position comes first, followed by every node in an even-numbered position. The relative order inside each group must stay unchanged.

Continue ...

LeetCode MEDIUM 319 Bulb Switcher Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

  • Difficulty: MEDIUM
  • Problem: Bulb Switcher
  • Topics: Math, Brainteaser

Problem gist

There are n bulbs, all initially off. The process runs for n rounds. On round 1, every bulb is toggled; on round 2, every second bulb is toggled; on round 3, every third bulb is toggled; and so on. The goal is to count how many bulbs remain on after the final round.

Continue ...

LeetCode HARD 295 Find Median from Data Stream Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Design a data structure that receives integers one at a time and can report the median of everything seen so far. If the count is odd, the median is the single middle value after sorting. If the count is even, it is the average of the two middle values.

Continue ...

LeetCode MEDIUM 235 Lowest Common Ancestor of a Binary Search Tree Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

The problem in plain language

Given a binary search tree and two different nodes p and q that are known to be in it, find their lowest common ancestor. This is the deepest node whose subtree contains both targets. A target may be its own ancestor, so if p is above q, the answer can be p itself.

Continue ...

LeetCode MEDIUM 230 Kth Smallest Element in a BST Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

The problem in plain language

Given the root of a binary search tree and a 1-indexed number k, return the value that would appear in position k if all node values were arranged from smallest to largest.

Continue ...

LeetCode MEDIUM 229 Majority Element II Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Given an integer array of length n, return every value that appears more than floor(n / 3) times. The output can contain at most two values: three different values cannot each occur more than one third of the time because their combined count would exceed n.

Continue ...

LeetCode MEDIUM 227 Basic Calculator II Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

The input is a valid arithmetic expression containing non-negative integers, spaces, and the four operators +, -, *, and /. The task is to evaluate it without using eval or a similar built-in expression evaluator. Multiplication and division must happen before addition and subtraction, and integer division must truncate toward zero.

Continue ...

LeetCode MEDIUM 204 Count Primes Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

  • Difficulty: MEDIUM
  • Problem: Count Primes
  • Topics: Array, Math, Enumeration, Number Theory

Problem gist

Given an integer n, the task is to count how many prime numbers are strictly smaller than n. A prime is an integer greater than one whose only positive divisors are one and itself. The word strictly matters: if n is prime, n is not included in the answer.

Continue ...