Yahoo Interview Questions
- -2of 2 votes
AnswersThe boggle game - given a 2d array of characters
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java - 1of 1 vote
AnswersEvaluate a given mathematical expression, taking into consideration the BODMAS rule. The expression contains no brackets.
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java - 0of 0 votes
AnswersThe Boggle game.
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSerialize and deserialize a tree.
- FauxPas June 07, 2014 in United States
Given a tree - not necessarily a binary tree - the serialize method should create a string for the tree. The deserialize method should be able to reproduce the same tree using the string derived from the serialize method.
Basically, serialize() takes in a tree and returns a string, deserialize() takes in a string and returns the tree.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java Object Oriented Design - 1of 3 votes
AnswersGiven a number N, find the smallest even number E such that E > N and digits in N and E are same.
- jerinsebastian.punnamada April 08, 2014 in United States
Print NONE otherwise.
Sample:
Input
N = 34722641
Output
E = 34724126
Input
N = 8234961
Output
E = 8236194 (instead of 8236149)
Java solution| Report Duplicate | Flag | PURGE
Yahoo Applications Developer Algorithm Java - 1of 1 vote
AnswersGiven two words, determine if the first word, or any anagram of it, appears in consecutive characters of the second word. For instance, tea appears as an anagram in the last three letters of slate, but let does not appear as an anagram in actor even though all the letters of let appear in slate.
- jerinsebastian.punnamada April 08, 2014 in United States
Return the anagram of the first word that has appeared in the second word.
Sample Input 1
tea
slate
Sample Output1
ate
Sample Input 2
let
slate
Sample Output2
NONE
java solution| Report Duplicate | Flag | PURGE
Yahoo Applications Developer Algorithm Java - 1of 1 vote
AnswersGiven a string, complete the given function to recursively remove the adjacent duplicate characters and return the resultant string. If there are no characters left in the resultant string, return "-1" (without quotes).
- jerinsebastian.punnamada April 08, 2014 in United States
Sample Test Cases
Sample Input: ABCCBCBA
Output: ACBA
Explanation: (ABCCBCBA --> ABBCBA --> ACBA)
Sample Input: AA
Sample Output: -1
Java solution| Report Duplicate | Flag | PURGE
Yahoo Applications Developer Algorithm Java - 0of 2 votes
AnswersWrite a class that displays average of stock prices for a given stock symbol for the last 10 minutes. We have a service that sends stock updates about 5000 times per second. The structure of the message is :
- budsiya March 21, 2014 in United StatesMessage { long timestamp; String symbol; // E.g. AAPL double price; }
| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Large Scale Computing System Design - 1of 1 vote
AnswersQueue implementation in Java.
- duskan March 20, 2014 in United States for Ad| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 1of 3 votes
AnswersGiven an array of integer, find the minimum in the sliding window of size 4, in most optimal way.
- duskan March 20, 2014 in United States for Ad
ex [2,1,3,4,6,3,8,9,10,12,56]
Output : [1,1,3,3,3,3,8.....]| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 2of 2 votes
AnswersDesign an iterator for a given stream of integers, with next() and hasnext() being called in any sequence, but skipping any 0's in the stream.
- duskan March 20, 2014 in United States for Ad| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind if a given array has any duplicates, with O(n) complexity
- duskan March 20, 2014 in United States for Ad| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 2 votes
AnswersGiven an array, print all the pairs that sum to a particular value. You are not given the value, find all possible values and print pairs for them
- amazing February 22, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer Intern Algorithm - 1of 3 votes
AnswersFind top K(1000) strings that occur frequently from a file having some billions of strings.
- Boyer Moor February 20, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 0of 0 votes
AnswersGiven a list of 'N' coins, their values being in an array A[], return the minimum number of coins required to sum to 'S'
- Boyer Moor February 20, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 2 votes
AnswersGiven a tree (Not a binary tree) and two nodes A and B, node has parent and child properties find the path P from A to B (In a tree there is only one path). Reduce the complexity to O(P).
- Anon January 20, 2014 in United States for Yahoo Sports| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 1of 1 vote
AnswersThere is an array of characters, say A[ ] and there is another array of doubles of equal size say W[ ]. Need to design a method called randomChar( ) that will return a character, but the probability of returning a character at index i ie. A[i] will be W[i].
- nosyDeveloper November 22, 2013 in United States
eg. A = ['a', 'b', 'c']
W = [0.3, 0.5, 0.2]
Then randomChar() called around 100 times should return approx 30 times 'a', 50 times 'b' and 20 times 'c'.
My approach was calculating cumulative probability for the array, eg. W' = [0.3, 0.8, 1.0], then generating random number between 0 and 1 and finally looking up the cumulative array for the right range of the number using binary search. The main problem was the modifications to the normal binary search to check the correct range of generated random number.| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Algorithm - 0of 0 votes
AnswersWe maintain stock prices of various companies. A stream of stock updates are coming in the form of ticker and value pair (example YHOO, 36.00). This value needs to be updated. We have a module of GUI that always displays top 5 stock prices at any given point of time. How would you maintain these values in memory?
- nosyDeveloper November 22, 2013 in United States
My solution was to maintain a max-heap and a map that maps ticker to the corresponding node in the heap. At every update, we look-up the node and update the value, but also note if it is an increase or decrease in value. If increase, we do a sift-up, if decrease, we do a sift-down on the heap for that node. For giving the top five values at any point of time, we don't want to disturb the order in the heap so we would copy the top five levels to a different memory and then perform 5 extract and heapifies on it.| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Data Structures - 0of 0 votes
AnswersWrite an interface for HashMap.
- nosyDeveloper November 22, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Java - 0of 0 votes
AnswersWe maintain stock prices of various companies. A stream of stock updates are coming in the form of ticker and value pair (example YHOO, 36.00). This value needs to be updated. We have a module of GUI that always displays top 5 stock prices at any given point of time. How would you maintain these values in memory?
- nosyDeveloper November 22, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Data Structures - -1of 3 votes
AnswersGiven a Tree (not essentially a BST). Find the right most cousin of a given node.
- juilee October 22, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Data Structures - 0of 0 votes
AnswersHow do you motivate software engineers? How to you encourage quality? What are your engineering principals?
- sarahschwanbeck October 20, 2013 in United States for Y! Suite| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Behavioral - 0of 0 votes
Answerswhite a function/method to determine if two strings are anagrams. What is the time complexity of the algorithm (big O)? Is there a more efficient way?
- sarahschwanbeck October 20, 2013 in United States for Y! Suite| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Algorithm - 1of 1 vote
Answerswrite a function to determine if two strings are anagrams? what is the run-time (big O) of this? Is there a better way to do this?
- sarahschwanbeck October 20, 2013 in United States for Y! Suite| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Algorithm - 1of 1 vote
AnswersWrite a function to check if the given chemical equation is balanced or not?
- R@M3$H.N October 01, 2013 in India
Ex:
Cu + S = CuS
2H2 + 02 = 2H2O| Report Duplicate | Flag | PURGE
Yahoo - -4of 4 votes
AnswersGiven 2 Arrays made up of 0's and 1's and of equal length. Find index m and n, such that m and n are farthest apart but contain equal number of 0's and 1's.
- aeiou811 August 09, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou are required to parse the xml file:
- vgeek August 09, 2013 in United States
<ledger>
<person>
<name>Jai</name><location>Bangalore</location>
</person>
<entries>
<entry><day>1</day><credit>50</credit><debit>40</debit></entry>
….
…
multiple entries were there, and multiple people were there.
We were required to validate the XML file.Open and Close tags matching.
We were required to parse, maintain the max balance for each person, the longest span of days each person had the max balance, and report queries such as who had the overall max balance , his span and location. Span must contain the day numbers, not length.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 0of 0 votes
AnswersConsider the problem of sorting in ascending order of an array of numbers where each number is in the range 50000 to 50000000. What sorting algorithm is the best choice for the above problem. What is the best case time complexity of sorting available to this problem.
- vgeek July 30, 2013 in United States
Options are:
a. Merge Sort
b. Insertion Sort.
c. Quick Sort.
d. Counting Sort.
e. Bubble Sort| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - -2of 2 votes
AnswersLongest increasing subsequence:
- pirate July 28, 2013 in United States
Given n numbers A1..An determine subsequence of maximum length values in the subsequence form a strictly increasing sequence.
ex: input 5,2,6,3,4,1,9,9,8,9,5
output: 2,3,4,8,9| Report Duplicate | Flag | PURGE
Yahoo Google Software Engineer / Developer Algorithm