Since your account isn't full access, you'll only have partial access to most questions. Upgrade Now

All Questions

Browse our full set of technical interview questions for software engineering jobs. They touch on a mix of algorithms, coding, and big-o notation.

Not quite ready to buy? Enroll in the free email course!

The questions below are reserved for paying users, but we drive home the same lessons in this free 7-day email course. Learn the right way of thinking for breaking down tricky algorithmic coding interview questions.

1
Apple Stocks »

Given yesterday's stock prices, find the max profit from one buy and one sell. A classic interview problem, solved in O(n) time and O(1) space. keep reading »

2
Product of All Other Numbers »

Given an array of integers, return an array where each item is the product of all the others, without division, in O(n) time. Step-by-step solution. keep reading »

3
Highest Product of 3 »

Find the highest possible product that you can get by multiplying any 3 numbers from an input array. keep reading »

4
Merging Meeting Times »

Merge overlapping meeting time ranges into condensed blocks: the classic merge intervals problem, with a step-by-step O(n lg n) solution. keep reading »

5
Making Change »

Count the number of ways to make an amount of money from a set of coin denominations (the number-of-ways version of coin change). Step-by-step solution. keep reading »

6
Rectangular Love »

Find the area of overlap between two rectangles. In the name of love. keep reading »

7
Temperature Tracker »

Write code to continually track the max, min, mean, and mode as new numbers are inserted into a tracker class. keep reading »

8
Balanced Binary Tree »

Write a function to see if a binary tree is 'superbalanced'--a new tree property we just made up. keep reading »

9
Binary Search Tree Checker »

Check whether a binary tree is a valid binary search tree. Avoid the common gotcha and solve it in O(n) time. A classic interview question, step by step. keep reading »

10
2nd Largest Item in a Binary Search Tree »

Find the second largest element in a binary search tree. keep reading »

11
MillionGazillion »

I'm making a new search engine called MillionGazillion(tm), and I need help figuring out what data structures to use. keep reading »

12
Find in Ordered Set »

Given an array of numbers in sorted order, how quickly could we check if a given number is present in the array? keep reading »

13
Find Rotation Point »

Find the rotation point (the smallest item) in a rotated sorted array in O(lg n) time. A classic coding interview problem, with a step-by-step solution. keep reading »

14
Inflight Entertainment »

Given a flight length and a list of movie lengths, find two movies that add up to exactly the flight length: a real-world two sum problem, in O(n) time. keep reading »

15
Compute the nth Fibonacci Number »

Computer the nth Fibonacci number. Careful--the recursion can quickly spin out of control! keep reading »

16
The Cake Thief »

Maximize the value of cakes that fit in a bag when you can take unlimited copies of each: the unbounded knapsack problem, solved step by step. keep reading »

17
JavaScript Scope »

There's something tricky going on with scope in this JavaScript. Can you guess what will get logged to the console? keep reading »

18
What's Wrong with This JavaScript? »

There's a tricky bug in this JavaScript. Can you find it? keep reading »

19
Implement A Queue With Two Stacks »

Implement a queue with two stacks. Assume you already have a stack implementation. keep reading »

20
Largest Stack »

Implement a stack with a get_max method that returns the largest item in O(1) time: the max stack problem, with a step-by-step solution. keep reading »

21
The Stolen Breakfast Drone »

Every ID appears twice except one. Find the unique one in O(n) time and O(1) space: the single number problem, with a step-by-step solution. keep reading »

22
Delete Node »

Write a function to delete a node from a linked list. Turns out you can do it in constant time! keep reading »

23
Does This Linked List Have A Cycle? »

Check whether a singly linked list has a cycle, using only O(1) additional space. A classic coding interview question, with a step-by-step solution. keep reading »

24
Reverse A Linked List »

Reverse a singly linked list in place and return the new head, in O(n) time and O(1) space. A classic interview question, solved step by step. keep reading »

25
Kth to Last Node in a Singly-Linked List »

Find the kth to last node in a singly linked list in O(n) time and O(1) space, a cousin of removing the nth node from the end. Step-by-step solution. keep reading »

26
Reverse String in Place »

Write a function to reverse a string in place. keep reading »

27
Reverse Words »

Write a function to reverse the word order of a string, in place. It's to decipher a supersecret message and head off a heist. keep reading »

28
Parenthesis Matching »

Write a function that finds the corresponding closing parenthesis given the position of an opening parenthesis in a string. keep reading »

29
Bracket Validator »

Check whether a string's brackets, braces, and parentheses are properly nested and closed: the valid parentheses problem, solved step by step in O(n) time. keep reading »

30
Permutation Palindrome »

Check if any permutation of an input string is a palindrome. keep reading »

31
Recursive String Permutations »

Write a recursive function of generating all permutations of an input string. keep reading »

32
Top Scores »

Efficiently sort numbers in an array, where each number is below a certain maximum. keep reading »

33
Which Appears Twice »

Find the repeat number in an array of numbers. Optimize for runtime. keep reading »

34
Word Cloud Data »

You're building a word cloud. Write a function to figure out how many times each word appears so we know how big to make each word in the cloud. keep reading »

35
In-Place Shuffle »

Do an in-place shuffle on an array of numbers. It's trickier than you might think! keep reading »

36
Cafe Order Checker »

Write a function to tell us if cafe customer orders are served in the same order they're paid for. keep reading »

37
Simulate 5-sided die »

Given a 7-sided die, make a 5-sided die. keep reading »

38
Simulate 7-sided die »

Given a 5-sided die, make a 7-sided die. keep reading »

39
Two Egg Problem »

A building has 100 floors. Figure out the highest floor an egg can be dropped from without breaking. keep reading »

40
Find Repeat, Space Edition »

Figure out which number is repeated. But here's the catch: optimize for space. keep reading »

41
Find Repeat, Space Edition BEAST MODE »

Figure out which number is repeated. But here's the catch: do it in linear time and constant space! keep reading »

42
Find Duplicate Files »

Your friend copied a bunch of your files and put them in random places around your hard drive. Write a function to undo the damage. keep reading »

43
Merge Sorted Arrays »

Write a function for consolidating cookie orders and taking over the world. keep reading »

44
URL Shortener »

Design a URL shortener like bit.ly or TinyURL: scope it, design the API and data model, generate short slugs, and scale it. A system design walkthrough. keep reading »

45
Graph Coloring »

Color the nodes in a graph so adjacent nodes always have different colors. keep reading »

46
MeshMessage »

You wrote a trendy new messaging app, MeshMessage, to get around flaky cell phone coverage. But messages are taking too long to send... keep reading »

Shan, happy user
“The problems on Interview Cake are equivalent to having a tutor in front of you. I can't believe how this problem set covered such a wide variety of algorithmic approaches in detail. It transformed the way I think about interviews and gave me immense confidence. — Shan
. . .