Quick recall mode

Keywords first, details second.

Use this mode when you want memory triggers only: title, summary, tags, and bullet anchors without long answers getting in the way.

Clear

Results update as you type. Press / to jump straight into search.

Quick recall

374 cards

Coding Exercises Medium O(1)

LRU Cache

Store items in an OrderedDict, move keys to the end whenever they are read or updated, and evict the oldest item when capacity is exceeded.

Implement an LRU cache with O(1) get and put operations.

Coding Exercises Easy O(n)

Majority Element

Track a running candidate and increment or decrement a counter as you scan. When the counter drops to zero, start fresh with the current value as the new candidate.

Return the element that appears more than n // 2 times in an array.

Coding Exercises Medium O(n log n)

Merge Intervals

Sort intervals by start, then compare each interval with the current merged tail. Extend the tail end when ranges overlap; otherwise append a new interval.

Merge all overlapping intervals and return the condensed list.

Coding Exercises Medium O(1)

Min Stack

Push each value onto the main stack and also onto a min stack whenever it is less than or equal to the current minimum. When popping, remove it from the min stack too if it matches the current minimum.

Implement a stack that supports push, pop, top, and get_min in constant time.

Coding Exercises Easy O(n)

Missing Number

Compute the expected sum from 0 through n and subtract the actual sum of the list to find the missing number.

Given numbers from 0 to n with one missing, return the missing value.

Coding Exercises Easy O(n)

Move Zeroes

Scan once, swap each non-zero value into the next write position, and advance that write pointer.

Move all zeroes to the end of the list while keeping the relative order of non-zero values.

Coding Exercises Medium O(n)

Next Greater Element

Walk the array from right to left and maintain a stack of candidates greater than the current value. Pop smaller values because they can never be the next greater element for earlier entries.

For each element in an array, return the next greater element to its right, or -1 if none exists.