LeetCode MEDIUM 1193 Monthly Transactions I Summary

Generated by Codex with GPT 5.6 Sol High

Quick facts

The problem in one picture

The Transactions table contains one row per transaction: its country, whether it was approved or declined, its amount, and its date. The requested report has one row for every (calendar month, country) pair and six columns:

Continue ...

LeetCode HARD 992 Subarrays with K Different Integers Summary

Generated by Codex with GPT 5.6 Sol High

Quick facts

Problem gist

Given an integer array nums and an integer k, count the nonempty contiguous subarrays that contain exactly k distinct values.

The word exactly makes the counting awkward. A normal sliding window is good at enforcing a one-sided condition such as β€œno more than k distinct values”: once a window has too many, move its left edge until it is valid again. But a valid window with exactly k distinct values may have several valid starting positions, so adding one answer for each right edge would miss subarrays.

Continue ...

LeetCode MEDIUM 930 Binary Subarrays With Sum Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Given a binary array nums and a nonnegative integer goal, count the nonempty contiguous subarrays whose elements add up to exactly goal.

Contiguous and exact are the important words. The same element may belong to many valid subarrays, and zeros create several subarrays with the same sum. For example, in [1, 0, 1, 0, 1], there are four different subarrays whose sum is 2.

Continue ...

LeetCode HARD 715 Range Module Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

  • Difficulty: HARD
  • Problem: Range Module
  • Topics: Design, Segment Tree, Ordered Set

Problem gist

A range module remembers which real-number intervals are currently being tracked. It must support three operations on half-open ranges [left, right):

  • add every point in a range to the tracked set;
  • remove every point in a range from the tracked set;
  • report whether every point in a range is tracked.

The half-open convention matters: adjacent ranges such as [5, 8) and [8, 12) fit together without overlapping, while removing [8, 10) leaves the first range untouched. Operations may overlap in any order, so the data structure must combine additions, preserve removals, and answer queries against the latest state.

Continue ...

LeetCode MEDIUM 622 Design Circular Queue Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

The task is to build a fixed-capacity first-in, first-out queue. It must support inserting at the rear, deleting from the front, reading both ends, and checking whether it is empty or full. An attempted insertion into a full queue and an attempted deletion from an empty queue must fail cleanly.

Continue ...

LeetCode MEDIUM 678 Valid Parenthesis String Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

The input contains opening parentheses, closing parentheses, and asterisks. Each * may act as (, act as ), or disappear. The task is to decide whether some choice for every asterisk makes the whole string a valid parenthesis sequence.

Continue ...

LeetCode MEDIUM 570 Managers with at Least 5 Direct Reports Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

The Employee table stores each employee’s ID, name, department, and manager ID. The task is to return the names of employees who manage at least five other employees directly.

Continue ...

LeetCode MEDIUM 450 Delete Node in a BST Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Given a binary search tree and a key, remove the node whose value equals the key and return the tree’s root. If the key is absent, the tree should remain unchanged. Every value is unique, so the binary-search-tree ordering identifies at most one node to delete.

Continue ...

LeetCode MEDIUM 443 String Compression Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

The input is an array of characters. It must be compressed in place by replacing each maximal run of equal characters with the character followed by the run lengthβ€”except that a run of length one keeps only the character. A count with multiple digits is written one digit at a time. For example, a, a, b, c, c, c becomes the meaningful prefix a, 2, b, c, 3, so the method returns 5.

Continue ...

LeetCode MEDIUM 438 Find All Anagrams in a String Summary

Generated by Codex with GPT 5.6 Sol XHigh

Quick facts

Problem gist

Given a text string s and a shorter pattern string p, the task is to return every starting index in s where a substring is an anagram of p. An anagram may arrange the letters differently, but it must contain exactly the same characters with exactly the same frequencies. Overlapping matches count separately.

Continue ...