Why Do They ask These Ridiculous Questions?
Because they need to know how you think. How you solve a problem right when it comes up. How well do you handle pressure? Do you become aggressive and blame others for something that's beneath you and your time? Or do you ask questions and have a natural curiosity?
No, you won't be implementing Quicksort at your job (most likely), nor will you need to traverse a binary tree. You will need to figure out solutions to problems that are hard, and you'll need to show that you can do that as a team player, without getting upset or frustrated.
To Do Well In These Interviews You Need To:
Know Your Data Structures
Arrays, maps, queues, trees and stacks – you will likely have to solve a problem that forces you to choose the most efficient data structure and then to explain how it works. There are always tradeoffs, do you know what they are?
Know Your Algorithms
Sorting, traversing, structuring and destructuring – you'll need to be able to apply various algorithms to a given situation. You'll also need to be able to discuss their complexity in both space and time using Big-O notation.
Write Code By Hand
This is something that most candidates overlook – myself included! When you're in the interview room, however, you will likely be asked to write code on the white board. When is the last time you had to do that? It's not easy!
Sounds like a lot of studying, doesn't it? It is, but it's doable and, more than that, it's fun! You'll learn a ton and we'll help you get through the process by:
Setting up a schedule and a journal.
You need at least 2 weeks to study the materials in this video, and to work the problems. You'll also need a place to practice doing things by hand: a nice, clean new journal or a tablet with a pen will do the trick.
Reviewing concepts and following along.
Practicing the problems while speaking aloud.
This video set can only take you so far, but we'll take a look at some outstanding resources you can use to practice what you've learned. We'll also show you how to speak about what you're doing, which is critical if you want the interviewer to know what you know.
We'll Also Need Some Help From a Friend: Jon Skeet
Jon Skeet, if you don't know, is the #1 user on Stack Overflow with 1,000,000 points in reputation. He also works at Google and interviews people often.
I wanted to see how an expert would solve these tough problems so I asked Jon to join me for a 5-question interview session, just like you would find at Google. He interviews people all the time - now he gets a taste of his own medicine!