Core Technical Interview Questions
Problems for Software Engineering Mastery
Computer Science is no more about computers than astronomy is about telescopes. Edsger Dijkstra, recipient of 1972 Turing Award

String to Byte Array Serialization and Deserialization
Serialize a list of strings into a byte array. Then deserialize it.

Given a tree, prune it to select for only a certain node color
Given that a tree is made of only red or black nodes, return another tree that only has the paths of the original tree leading to a red node.

Calculate your Social Graph Klout Score
Write the algorithm that LinkedIn.com uses to tell you how many professionals you have access to.

Sort a million 32bit integers
What is the most efficient way to sort a million 32bit integers?

Find the missing element in a randomized range of numbers
I take n consecutive integers, toss one of them out and mix up the remaining n1 integers as completely unsorted. Find the missing integer.

Return true if input is a Prime number
You are given n, a positive integer. Return true if n is a prime number, and false if it's not.

Unlocked Multithreaded Variable Incrementation
You have two threads incrementing the same variable in parallel. Graph the possible outputs overtime.

Find the middle node of a Linked List
Given a Singly Linked List, write an algorithm to find the middle node. You may not use more than one loop of any kind.

Fibonacci Series Dynamic Programming
Return the Nth element of the Fibonacci series (1, 1, 2, 3, 5, 8, 13, 21, ...) efficiently without using any FOR or WHILE loops.

Reverse the order of the words in a String inplace.
Reverse the order of the words in a String inplace.

Closest Common Ancestor of a Node in a Tree
You have a tree data structure. Write an algorithm that given any two nodes in the tree, finds the node that is the closest common ancestor to them.

Extreme Recursion with Binary Tree Topologies
How many binary tree topologies are possible given n nodes?

Rulebased HTML compilation
Given an HTML with messed up tag nesting, output the correct and unambiguous version of the HTML.

Reverse a Singly Linked List
Implement the algorithm to reverse a singly linked list.

Is the given String a repeated subpattern?
Given a string, return whether it is made of a perfectly repeated string pattern.

Time Complexity of ArrayList Insertion
Then calculate the average time complexity of inserting n new items into an empty brand new ArrayList.

Graph Cycle Detection
You have a directed connected graph. Write an algorithm that detects any cycle, if one exists, and returns a list of its nodes.

Language Vocabulary Sampling
You are given a stream of conversation in a mysterious language from planet Mars. Approximate the set of word vocabulary in this language.

Find the odd ball among eight balls
You are given eight balls that look exactly the same, and a balance to weigh them against each other. Find the odd ball by weighing only twice?

MapReduce parallel processing of all known URLs for median length
You are given the data set of all Google crawled URLs on the Internet  that's a very large set. Write an algorithm to find the median URL length.

Google search results for the top 1000 highest ranking URLs
You have trillions of URLs stored uniquely, without order, across numerous machines, each with a score. Find the 1000 URLs with the highest scores.

Breadth First Tree Traversal
Write an algorithm that takes a tree data structure and writes out all the elements in a breadthfirst traversal order.

Map Reduce Data Mining and Ranking
Given a Google Search Query, find the AdWords Categories best describing it

Prisoner's Dilemma With Blindfolds: a math teaser
Seven people are blindfolded and given unique colored hats at a roundtable. How should they cooperate for at least one to guess her own color?

Getting paid for seven days with a single bar of gold
An employer hires you to work for 7 days and has a gold bar with 7 segments to pay you with. How do you get them to not break it to pieces?

Circular Linked List Detection
A linked list is given. Write an algorithm that detects whether it's a singly linked list or a circularly linked list.

Tree InOrder Traversal to Next Node
Given a node in a binary tree, implement the algorithm for finding its next inorder node in the containing tree.

Maximum contiguous submatrix
Find the contiguous 2dimensional submatrix with the maximum sum, in a given 2 dimensional matrix of n elements of signed integer type.
About the sources
As a software engineer, I've been fortunate enough to do a tour of duty or high level interviews in some of the best technology companies in the world at their prime time, including Microsoft, Amazon, Google, Facebook, and several startups I joined or founded. At many of these I've also interviewed now hundreds of engineers from the other side of the desk (or whiteboard).
It has always been surprising to me how perhaps only 10% of interview candidates know what to expect. Most candidates are surprised by the types of questions asked in an interview, and try to deflect them as "this stuff only mattered in college." Instead, they think "getting through the interview" depends on how solid your social connectoins are at the prospective company. No! Honestly no! References matter for getting to the screening interview and in some cases even past it, but that's not what gets you through the typical 5hour technical interview!
I've put together sample material for you to study if you're headed to a technical interview. If this stuff seems hard, invest a few bucks and a few days on an algorithms book. Take 24 weeks to study. It's a lot easier than resisting. This was true for me, for my friends, and hundreds of people who succeed or fail before the process has even begun based on their level of openness to the idea that fundamentals are indeed going to be the core subject of the interview. Success happens when preparation meets opportunity.