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(n^2)

3 Sum

Sort the array, fix one value at a time, and use two pointers on the remaining range. Skip duplicate anchors and duplicate pointer values so the result contains unique triplets only.

Return all unique triplets in an array whose sum is zero.

Coding Exercises Easy O(n)

Anagram Check

Either sort both strings and compare them, or build character frequency maps. The hash-map version is linear time and communicates counting skill well.

Check whether two strings contain the same characters with the same counts.

Coding Exercises Easy O(log n)

Binary Search

Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.

Given a sorted list and a target, return the target index or -1 if it is missing.

Coding Exercises Medium O(n)

Binary Tree Traversals

Write a DFS helper that appends the current node before, between, or after visiting children depending on which traversal you are building.

Return the inorder, preorder, and postorder traversals of a binary tree.

Coding Exercises Easy O(n)

Climbing Stairs

Each position depends on the previous two positions, so keep only the last two counts and build forward iteratively.

Return how many distinct ways there are to reach the top if you can climb 1 or 2 steps at a time.

Coding Exercises Medium O(amount * len(coins))

Coin Change

Initialize a DP array with an impossible sentinel value, set dp[0] to zero, and for each amount try every coin to update the cheapest reachable solution.

Given coin denominations and a target amount, return the minimum number of coins needed to make that amount or -1 if it is impossible.

Coding Exercises Medium O(n)

Container With Most Water

Use left and right pointers, compute the current area, and always move the side with the smaller height because only that can improve the limiting wall.

Find two lines that together hold the maximum area of water.