Programming, Software, and Technical Interview Questions
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.
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...
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...
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
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.
Function signature: double findNthLargest(double array, int n) where `0 <= n < array.length`.
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`.
For example, given abc your function should return abc acb bac bca cab cba as the output.
Facebook over 1 year ago 789 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...
# 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...
# 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...
Implement the solution in a language of your choice. Analyze the runtime complexity.
Yelp over 1 year 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.
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
As a follow-up: what if the number of strings cannot fit into memory?
Function signature should look like void print(LinkedList list);
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 almost 2 years ago 15 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 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...
# 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...
Other almost 2 years ago
1. Obvious: `(x << 3) - x` 2. Avoiding potential overflow: `(x << 2) + (x << 1) + x`