Interview in a few hours?

Brush up before you log in.

Fast recall cards, focused search, and just enough detail to refresh the right answers before the interview starts.

Clear

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

All revision cards

49 cards

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 Hard O(n + m)

Minimum Window Substring

Track how many required characters are satisfied as you grow the right edge. Once the window is valid, shrink from the left to find the smallest valid window before expanding again.

Return the smallest substring of s that contains all characters from t.

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.

Coding Exercises Medium O(rows * cols)

Number of Islands

Scan the grid cell by cell. When you find unvisited land, increment the island count and run DFS or BFS to mark every connected land cell as visited.

Count how many islands of connected land exist in a grid of '1' and '0' values.

Coding Exercises Easy O(n)

Palindrome Check

Compare characters from the left and right ends while moving inward. Normalize case or strip non-alphanumeric characters only if the prompt requires it.

Determine whether a string reads the same forward and backward.

Coding Exercises Medium O(n)

Remove Nth Node From End

Use a dummy node, move the fast pointer n steps ahead, then move both fast and slow together until fast reaches the end. The slow pointer will be just before the node to remove.

Remove the nth node from the end of a linked list and return the head.