Friday, October 12, 2012
Design a system where you can reutrn top 20 queries made in last 24 hours to users. Think on the scale of Google and Yahoo. How would you store data. What will be your data structures, algorithm to get that data.Describe your assumptions etc. For simplicity, you can assume that every web server create a log file with query and timestamp.
Labels:Data
Google Interview
A legend among a group of n people is a person who is top rated in all respects.The task is to identify a legend by asking a single question of the form "who deserves it?" Design an efficient algorithm to identify a legend or determine if the group has no such person.How many questions does your algorithm need in the worst case??
Labels:Data
Amazon Interview
Wednesday, October 3, 2012
Sunday, September 30, 2012
While travelling in a cycle race, there are several pit stops. A cyclist can travel upto 50 km without stopping at any pit stop, where he can have a health drink and refill his energy. Given a start point ’t’ and let ’k’ be the distance needed to be travelled by the cyclist, find an efficient algorithm to reach the destination ’d’ so as to have minimum pit stops and prove your algorithm is the most optimal one.
Labels:Data
Microsoft Interview
You have given n numbers from 1 to n. You have to sort numbers with increasing number of set bits.
for ex: n=5.
output: 1,2,4,3,5
Note: If you have two number with equal number of set bits, then number with lowest value come first in the output.
output: 1,2,4,3,5
Note: If you have two number with equal number of set bits, then number with lowest value come first in the output.
Labels:Data
Microsoft Interview
Wednesday, September 26, 2012
Monday, September 24, 2012
You have N computers and [Ca, Cb] means a is connected to b and this connectivity is symmetric and transitive. then write a program which checks that all computers are interconnected and talk two each other
I Believe there are multiple way to solve this problem
1. Here is my approach since graph is connected there will be path from each source to destination vertex , isn't it ?
so we can simply run a dfs or bfs for all computers to check if all such path exist , finally we can return & of all operation that means all computer are inter connected and can talk to each other .
PS.Since graph is undirected if there exist path from u to v then vice-verse also true so we wont calculate it again.
Labels:Data
Adobe Question
,
Google Interview
Subscribe to:
Posts
(
Atom
)