# Programming, Software, and Technical Interview Questions

## Find the only number that occurs an odd number of times in a list

### Salesforce.com 5 months ago 3 answers

You have an array of integers. All the numbers occur an even number of times except for one number that occurs an odd number of times. Example: 1 1 3 3 5 5 8 8 8 9 9 9 9 Answer: 8 occurs odd number of times

## Write a program to reverse a Binary Tree

### Other 7 months ago 1 answer

Write a program to reverse a binary tree.

## Question about recursion in python

### Google 11 months ago 2 answers

I'm having a problem writing a python code to find the lowest common divisor recursively(for instance: for 9 -3, for 49 -7, for 0 -2, for 7 -1).I would like to see a written code. my code is this(and I know it's not the best code and if you can help me to change what it's...

## hash tables

### Other over 1 year ago 2 answers

You are required to implement the following empty functions: **1. **Search 2. Insert 3. Lookup 4. deleteKey Use chaining** to solve collision.** 2. Write your program to test your code with a table of <int, string> (integer key and string data) that has 15 entries. Tes...

## c++

### Apple over 1 year ago

Assume a binary tree of non-repeated characters. Write a function printPostOrder that takes two strings representing the preorder traversal and the in-order traversal of the tree. Then the function pr

## Write a function to calculate an arithmetic expression represented as a string

### Facebook over 1 year ago 6 answers

The arithmetic expression will be simple, and only contain addition, subtraction, multiplication, and division operators. A harder follow-up question is to handle parentheses in the expression.

## Find the nth largest number in an array

### Facebook over 1 year ago 3 answers

Function signature: double findNthLargest(double[] array, int n) where `0 <= n < array.length`.

## Sum a collection of strings that represent binary numbers

### Facebook over 1 year ago 4 answers

Your function, `sumBinary(String arg ...)` should return the sum of the binary numbers represented as strings. For example, `sumBinary("1010", "111", "100010")` should return `10 + 7 + 34 = 51`.

## Given a string, return all permutations of the string

### NVIDIA over 1 year ago 2 answers

For example, given abc your function should return abc acb bac bca cab cba as the output.

## Facebook Engineering Puzzle - User Bin Crash

### Facebook over 1 year ago 790 answers

# User Bin Crash You are on a cargo plane full of commercial goods when the pilot announces that the plane is short on fuel. Unless cargo is ejected from the plane, you will run out of fuel and crash. The pilot provides you with the number of pounds of weight that must...

## Facebook Engineering Puzzle - Dance Battle

### Facebook over 1 year ago 2 answers

# Dance Battle During an otherwise subdued night out on the town, you find yourself engaged in a fierce dance battle with a formidable opponent. After a number of turns in the battle have already been taken, both you and your adversary realize that you are at risk of b...

## Facebook Engineering Puzzle - It's A Small World

### Facebook over 1 year ago 2 answers

# It's A Small World As a popular engineer, you know many people in your home city. While traveling around town, visiting your friends, you realize it would be really handy to have a program that tells you which of your friends are closest based upon which friend you a...

## Find the max and min elements of an unsorted integer array using a minimal number of comparisons

### Facebook almost 2 years ago 3 answers

Implement the solution in a language of your choice. Analyze the runtime complexity.

## Build a recommender system for restaurants on Yelp

### Yelp almost 2 years ago

Assume you have access to all Yelp data. Specify the data sources you would use, what approaches you would take, and describe your implementation. Consider scale, evaluation, metrics, etc.

## Given an array of integers, pick a random value with a probability proportional to its value

### Yelp almost 2 years ago 3 answers

That is, larger integers should have a larger probability of being chosen. E.g. the value of each element in the array can be considered to be its "weight."

## High coverage can always be achieved by writing a unit test for every method. True False

### Adobe almost 2 years ago 1 answer

High coverage can always be achieved by writing a unit test for every method. True False

## Find the number of unique strings in a collection of strings

### Facebook almost 2 years ago 6 answers

As a follow-up: what if the number of strings cannot fit into memory?

## Reverse a linked list and then print its contents

### Facebook almost 2 years ago 3 answers

Function signature should look like void print(LinkedList list);

## How would you find and replace a string in many files?

### Yelp almost 2 years ago 3 answers

Assume the files are in an arbitrary file directory structure, with directories and subdirectories. You can use whatever pre-built tool you want, but you must replace all occurrences of a given string with another string in said files, as quickly as possibel.

## Facebook Engineering Puzzle - Liar Liar

### Facebook almost 2 years ago 16 answers

# Liar, Liar As a newbie on a particular internet discussion board, you notice a distinct trend among its veteran members; everyone seems to be either unfailingly honest or compulsively deceptive. You decide to try to identify the members of the two groups, starting wi...

## Facebook Engineering Puzzle - Gattaca

### Facebook almost 2 years ago 29 answers

# Gattaca You have a DNA string that you wish to analyze. Of particular interest is which intervals of the string represent individual genes. You have a number of "gene predictions", each of which assigns a score to an interval within the DNA string, and you want to fi...

## Facebook Engineering Puzzle - Breathalyzer

### Facebook almost 2 years ago 1 answer

# Breathalyzer To safeguard against the dreaded phenomenon of wall posting while drunk, Facebook is implementing a feature that detects when post content is too garbled to have been done while sober and informs the user that they need to take an online breathalyzer tes...

## Convert a string representing a Roman number into a decimal

### Other almost 2 years ago 1 answer

http://en.wikipedia.org/wiki/Roman_numerals

## Give a fast way to multiply a number by 7

### Other almost 2 years ago

1. Obvious: `(x << 3) - x` 2. Avoiding potential overflow: `(x << 2) + (x << 1) + x`