Yahoo Interview Questions
- 2of 4 votes
AnswersGiven a sequence of numbers A(1) ..A(n), find the continuous subsequenceA(i)..A(j) for which the sum of elements is maximum.
- pirate July 28, 2013 in India
condition: we should not select two contiguous numbers| Report Duplicate | Flag | PURGE
Yahoo Facebook Software Engineer / Developer Algorithm - 4of 4 votes
AnswersGiven infinite array in which the first n cells contain integers in sorted order and rest filled with symbol $. Assume we don't know n value. Give algorithm that takes an integer k as input and finds a position in array in O(logn)
- pirate July 27, 2013 in India| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersMerge sort is better for linked lists. How and implement ?
- pirate July 26, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswerHow we implement linked lists sorting with quick sort.
- pirate July 26, 2013 in United States
Note:- you can modify quick sort implementation.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersMaximum value Continuous Subsequence:
- pirate July 25, 2013 in United States
Given array A[n] find continuous subsequence a[i]..a[j] for which sum of elements in the subsequence is maximum.
Ex: {-2, 11, -4, 13, -5, -2} --> 11 - 4 +13 = 20
{1, -3, 4, -2, -1, 6} --> 4 -2 -1 +6 = 7
Time complexity should O(nlogn)| Report Duplicate | Flag | PURGE
Yahoo Microsoft Linkedin Software Engineer / Developer Algorithm Arrays - 4of 4 votes
AnswersYou are having a 500 MB RAM and you have a program which uses malloc to allocate 600 MB memory . What will happen , will it be allocated using the concept of virtual memory or not , if yes how?
- P3A July 23, 2013 in India| Report Duplicate | Flag | PURGE
Yahoo SDE1 Operating System - 0of 0 votes
AnswersWrite data structure for query such as given user it returns all pages he visited with frequency.
- PT July 21, 2013 in United States
If users clicks pages its (page) frequency count increases by 1.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Data Structures - 0of 0 votes
AnswersGiven an Array A[], find the maximum j - i such that A[j] > A[i].
- pirate July 20, 2013 in India
For example Input { 34,8,10,3,2,80,30,33,1} and Output 6 (j=7, i=1)
Time Complexity should be less then O(n^2)| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a MapReduce job that takes in two text files, and output the probability that those two files are identical (with 0% -> completely different, 100% -> completely different).
- tazo June 06, 2013 in United States
Clarification: Matching should not be a per-line diff, but it's about the content. One article could be 80 characters per line in one version, but could be 100 characters per line in another version, for the same content. In that case, it should be 100% match even though, if you are comparing line by line, they are totally different.| Report Duplicate | Flag | PURGE
Yahoo Coding - 1of 1 vote
Answersfollowing coins: half dollar, quarters,dime, nickel and penny. Print all the possible combinations of coins that will equal to one dollar.(Ex : (2) half-dollar , (4) quarter dollar etc )..
- Algorithms_99 April 29, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Applications Developer Coding - 0of 0 votes
AnswersIf there is a million data in file(assume integers).
- rahul.jain215 March 15, 2013
The memory is enough to hold all the data.
After loading all the data into data structure , we need to insert 500 new integers after the 10000th element.
What Data structure to use and how to use?| Report Duplicate | Flag | PURGE
Yahoo Intern Algorithm - 0of 2 votes
AnswersGiven a list of quantity of books and corresponding prices.User wants to purchase Q quantity of books. Provide an algorithm which suggest user Q Quantity of books with minimum price
- csgeeg February 17, 2013 in India
e.g
Quantity of Books 10 20 30 15 25
price of books 100 200 120 130 165
user wants to purchase 500 quantity of books.come up with minimum price| Report Duplicate | Flag | PURGE
Amazon Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersProblem Statement :
- kumar.prince6 November 11, 2012 in India
• Given an 4n X 4n Matrix, where n is a positive integer taken as input. Imagine the matrix consisting of two interleaved coils whose centers are at the centre of the matrix. Implement a java program which takes an integer (n) as input and prints the two coils in two seperate lines.
Please have a look at the below examples to get a sense of what the two coils are :
• Example 1:
• Input: 1
• Matrix:
01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16
• Output the Two Coils as:
- Coil1: 10 06 02 03 04 08 12 16
- Coil2: 07 11 15 14 13 09 05 01
• Example 2:
• Input: 2
• Matrix:
01 02 03 04 05 06 07 08
09 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
• Output the Two Coils as:
- Coil1: 36 28 20 21 22 30 38 46 54 63 52 51 50 42 34 26 18 10 02 03 04 05 06 07 08 16 24 32 40 48 56 64
- Coil2: 29 37 45 44 43 35 27 19 11 12 13 14 15 23 31 39 47 55 63 62 61 60 59 58 57 49 41 33 25 17 09 01| Report Duplicate | Flag | PURGE
Yahoo Developer Program Engineer Arrays - -1of 1 vote
AnswersSuppose there is an array with numbers :
- codemonkey November 09, 2012 in United States for Search
1, 14, 5, k, 4, 2, 54, k, 87, 98, 3, 1, 32
Output for this can be assuming k =20
1,14,5,4,2,3,1,k,k,54,87,98,32
Now sort this array in a way all k are in middle and all values on left of k are smaller (in any order) and on right are larger (in any order)
Note: k is an integer value within range of 1 - 32768
Follow up: Sorting is ok. what sorting you want to use ? still is sorting necessary ? are there any other approaches ?
Follow up: Used External array with 2 pointers and 3 pointers approach. They wanted more efficient solution.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersHow would you design an Excel sheet's Data structure. You need to perform operations like addition. The excel sheet is very sparse and is used to store numbers in the range 1-65K. Index for a cell is known.
- codemonkey November 09, 2012 in United States for Search| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersHow to sort a 1000 GB file with ram size is 4 GB only. Which algorithm or data structure we need to use to sort these files?
- codemonkey November 09, 2012 in United States for Search
Follow Up: External sort is Ok... but how can you make this solution more efficient...
Follow Up 2: Ideal chunk size for external sort (I said 512 MB based on my experience with MS Word 2013, it can not load file size >512 MB)| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
Answersgiven m x n matrix print all the possible paths top to down.
- junk.programmer October 17, 2012 in United States
Example
1 2 3
4 5 6
7 8 9
path for root(0,0) 1
1-4-7
1-4-8
1-5-7
1-5-8
1-5-9
similarly path for 2(0,1)
2-4-7
2-4-8
2-5-7
2-5-8
2-5-9
2-6-8
2-6-9
note- root 1 can go to middle down or right down since there is no left index available. if root element has left middle and right it can go to all those paths like 2 or 5.
follow up : provide the path which has maximum path sum.
code in java.| Report Duplicate | Flag | PURGE
Yahoo Computer Scientist Matrix - 0of 0 votes
AnswersHow would the Destructor for Singleton look like ?
- BJ October 09, 2012 in India
dbx and how to debug a multi threaded application
Use of virtual destructor
Practical usage of STL set.| Report Duplicate | Flag | PURGE
Yahoo C++ - 0of 0 votes
AnswersI have an arrayList A which contains say 2,3,5,7,8
- gadha October 04, 2012 in India
I have another arrayList B which contains 1, 3
Now taking the elements of B as the locations, I need to remove the elements of A present in that locations. So, basically I need to remove the element 2(position 1) and 5(position 3) from A. How to achieve it as we know that once one element got removed from an arrayList,the positions will be auto adjusted.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Java - 0of 0 votes
AnswersYou are given N points in a X-Y plane. Find the two closest points out of them.
- deadman September 06, 2012 in India| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a few numbers, how will you push them into a stack such that whenever I pop the top most element from that stack, I get the minimum number from the bunch. Also he wanted me to tell the pop push algorithm such that the order of insertion and popping should be O(1).
- kb August 17, 2012 in India| Report Duplicate | Flag | PURGE
Yahoo - 1of 1 vote
AnswersGiven a set of positive integers S = { a1,a2,a3,...,an} find two subsets s1 and s2 of A such that S2 = S - S1 and difference of | sum(S1) - sum(S2) | is minimum.
- ashok.singh.sairam August 04, 2012 in India
For example if we have a set S={12,4,7,1,6,3,3 }then S1= {12,6} and S2={ 4,7,1,3,3} such that sum(S1) - sum(S2) = 0 . It is not necessary that two subsets will always have the same sum.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou are blindfolded and placed in front a table with two jars. One jar has 50 red balls and other has 50 blue balls. What should be your strategy so that you pick up the red ball with more than 50% probability.
- irraju July 24, 2012 in India| Report Duplicate | Flag | PURGE
Yahoo Developer Program Engineer - 0of 0 votes
AnswersIn 1000 wine bottles stack 10 are poisoned given 10 rats what is the minimum number of tries to find the poisoned one. Rat dies once it licks the poisoned wine.
- Pranay Singhania May 27, 2012 in India| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Math & Computation - 1of 1 vote
AnswersCelebrity problem:
- sreemana@buffalo.edu March 26, 2012 in United States
You have a room with n people. A celebrity walks in. Everyone knows the celebrity, the celebrity knows no one. Non-celebrities may/may not know anyone in the room. Give an algorithm to find the celebrity. Discuss the complexity.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersThis is a very simple question. But im not sure why the answer is the way it is.
- sreemana@buffalo.edu March 26, 2012 in United States
int main()
{
char *c = "abc";
*c = 'd';
printf("%s",c);
return 0;
}
What gets printed?
I said dbc for which he dint say anything and went ahead.
I coded this and found that I my compiler doesn't even give a response. I don't understand, *c sets the value being pointed to 'd' so technically this is legal right?
Can someone pitch in?| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 0of 0 votes
AnswersDifference between == and === in JScript, Write a method to detect mouse hovering over a text box using CSS style sheets
- Gloryhunter February 26, 2012 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Front End Web Development - 0of 0 votes
AnswersDesign a simple Address book Web application, Discuss all aspects of creating the App , starting from UI to Back-end databases
- Gloryhunter February 26, 2012 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersDesign a client-server application in the Application layer of TCP/IP
- Gloryhunter February 26, 2012 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Application / UI Design