Programming, Software, and Technical Interview Questions

hash tables

Other 21 days ago

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 27 days 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 3 months ago

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 3 months ago

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

Sum a collection of strings that represent binary numbers

Facebook 4 months ago 1 answer

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 4 months ago 1 answer

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

Facebook Engineering Puzzle - It's A Small World

Facebook 5 months ago 1 answer

# 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...

Facebook Engineering Puzzle - User Bin Crash

Facebook 5 months ago 11 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 5 months 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...

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

Facebook 6 months ago 1 answer

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

Implement the sqrt() function

NVIDIA 6 months ago 1 answer

Signature: double sqrt(int x)

Build a recommender system for restaurants on Yelp

Yelp 6 months 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 7 months ago 1 answer

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 7 months 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 7 months ago 3 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 7 months ago 2 answers

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

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

Yelp 8 months ago 2 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 - Breathalyzer

Facebook 8 months 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...

Facebook Engineering Puzzle - Gattaca

Facebook 8 months ago 3 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 - Liar Liar

Facebook 8 months ago 5 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...

Convert a string representing a Roman number into a decimal

Other 8 months ago 1 answer

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

Give a fast way to multiply a number by 7

Other 8 months ago

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

Write a function to return the nth element of a binary tree in an in-order traversal

Facebook 9 months ago 3 answers

First asked to define the binary tree data structure. Then to implement the function.

Write a class to implement a hashtable that can take a fixed initial capacity

Microsoft 9 months ago 2 answers

For simplicity, assume that the hashtable only holds unsigned integers.

Find the N most frequently occurring words in a billion lines of text

Facebook 9 months ago 2 answers

Solve the problem in an efficient manner. i.e. use existing tools if possible.

Companies

Adobe Amazon.com AOL Apple Bloomberg Cisco eBay Electronic Arts Facebook Goldman Sachs Google Hewlett-Packard IBM Intel Intuit LinkedIn Microsoft Morgan Stanley NetApp Netflix NVIDIA Oracle Other Qualcomm Salesforce.com Twitter VMware Yahoo! Yelp Zynga