I've been interviewing a lot lately, and I've come across a lot of mundance technical interview questions, along with some more interesting ones. I've put together a list of them below, and I'll try to keep this updated when I have more interviews.
The interesting ones
- Write a function to calculate the square root of a float.
- You are given a 100 boxes with 100 balls in each, each ball weighing 1. One box’s balls weigh 0.99. You have a scale that can do 1 weighing. Find the lighter box. You may modify the boxes however you like.
- Write a function to return all n digit numbers. Now, change that function to only return numbers that have sum s. Now, change that function again to return only the first instance of each sum.
- What is the difference between the World Wide Web and the Internet? What about an internet and an intranet?
- You have a database table with products and quantities. How do you prevent overselling when many users buy the product at the same time?
- Write a function to take a random sample from an array. Now, change that function to instead use an iterator with methods .next() and .hasnext()
- You're making a Twitter clone. What is the database schema? How do you get a user's stream? How do you scale?
- Determine if a paragraph is a plagiarized from another paragraph.
- Given an infinite input of timestamps and stock prices, you need access to min/max and last price. Timestamps may be repeated or sent out of order. If a time is repeated, it overwrites the previous one.
- Given a list of words and a sequence of numbers that correspond to letters on a phone, return all possible words with that prefix.
- Given an array of numbers corresponding to building heights, how much water remains if it rains and fills in all the building spaces?
The stupidly common ones
If you are interviewing, I would recommend knowing everything here inside and out.
- Describe OOP.
- Describe hash tables. Describe binary trees. Describe binary search. Runtimes of everything.
- What is good and bad about x language?
- Write a function to return duplicates from an array.
- Write a recursive function to sum an array, or to reverse a string.
- Reverse a linked list. Detect cycles in a linked list.
- Dynamic programming questions, eg. Levenshtein distance and longest increasing subsequence.
- Use DFS/BFS to solve graph problems.
- Describe MVC.
- Describe SQL joins.
- Describe locking and atomicity.
- What happens when you enter www.google.com in your browser and hit enter?
- What are the types in JS?
- What is the difference between == and ===? (I hate this one because I've literally heard it 5+ times)
- Describe prototypal inheritance.
- What is a closure? (not JS specific, but this is usually asked with the other JS questions)
- Describe scoping. What is hoisting?
- What is a generator? What is a decorator?
- Why does multithreading suck?
- How does lazy loading in Django work?