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 ...

LeetCode MEDIUM 184 Department Highest Salary Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

What the problem is asking

There are two tables. Employee stores each employee’s name, salary, and department ID, while Department maps each department ID to a display name. The result must contain every employee whose salary is the highest in that employee’s department.

Continue ...

LeetCode MEDIUM 143 Reorder List Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

  • Difficulty: MEDIUM
  • Problem: Reorder List
  • Topics: Linked List, Two Pointers, Stack, Recursion

Problem gist

The input is a singly linked list in its ordinary front-to-back order:

L0 → L1 → L2 → ... → Ln

It must be rearranged by alternating nodes from the front and back:

Continue ...