## 352905

BAN USER- 5of 5 votes

AnswersLet's say you have 10,000 servers, each with a billion integers. How do you find the median?

- 352905 in United States| Report Duplicate | Flag | PURGE

Facebook Software Engineer / Developer Algorithm - 44of 48 votes

AnswersPots of gold game: Two players A & B. There are pots of gold arranged in a line, each containing some gold coins (the players can see how many coins are there in each gold pot - perfect information). They get alternating turns in which the player can pick a pot from one of the ends of the line. The winner is the player which has a higher number of coins at the end. The objective is to "maximize" the number of coins collected by A, assuming B also plays optimally. A starts the game.

- 352905 in United States

The idea is to find an optimal strategy that makes A win knowing that B is playing optimally as well. How would you do that?

At the end I was asked to code this strategy!| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm - 1of 1 vote

AnswersImagine you have a sequence of the form 0123456789101112131415... where each digit is in a position, for example the digit in the position 5 is 5, in the position 13 is 1, in the position 19 is 4, etc.

- 352905 in United States

Write a function that given a position returns the digit in that position.

(You could think that this sequence is an array where each cell only holds one digit so given an index return what digit is in that index, however you cannot really create an array since the sequence is infinite, you need a way to based on the index calculate the digit that goes there).

The function has to return a single digit.

Other examples:

index = 100, result = 5

index = 30, result = 2

index = 31, result = 0

index = 1000, result = 3| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

- 352905 July 16, 2014