## Yahoo Interview Questions

- 0of 0 votes

Answersdesign a datastructure to represent the movement of a knight on a chess board

- gullu September 12, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerWrite an algorithm to traverse a knight covering all the squares on a chessboard starting at a particular point.

- gullu September 12, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersThere is a temple, whose premises have a garden and a pond. It has 4 idols, each of Ram, Shiv,

- gullu September 12, 2010

Vishnu and Durga. The priest plucks x flowers from the garden and places them in the pond. The number of flowers

doubles up, and he picks y flowers out of them and goes to offer it to Lord Ram. By the time he reaches

to the pond, he finds the remaining flowers also have doubled up in the meantime, so he again picks up y

from the pond and goes to Lord Shiv.This process is repeated till all the Gods have y flowers offered to them,

such that in the end no flower is left in the pond. Find x and y.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Brain Teasers - 0of 0 votes

AnswersOn a empty chessboard, a horse starts from a point( say location x,y) and it starts moving randomly,

- gullu September 12, 2010

but once it moves out of board, it cant come inside. So what is the total probability that it stays

within the board after N steps.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersYou are given with three sorted arrays ( in ascending order), you are required to find a triplet

- gullu September 12, 2010

( one element from each array) such that distance is minimum.

Distance is defined like this :

If a[i], b[j] and c[k] are three elements then

distance=max(abs(a[i]-b[j]),abs(a[i]-c[k]),abs(b[j]-c[k]))"

Please give a solution in O(n) time complexity| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersGiven a Data Structure having first n integers and next n chars. A = i1 i2 i3 ... iN c1 c2 c3 ... cN.

- gullu September 12, 2010

Write an in-place algorithm to rearrange the elements of the array ass A = i1 c1 i2 c2 ... in cn| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerThere is a linked list of numbers of length N. N is very large and you don’t know N. You have to write a

- gullu September 12, 2010

function that will return k random numbers from the list. Numbers should be completely random.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerThere are a set of 'n' integers. Describe an algorithm to find for each of all its subsets of n-1 integers

- gullu September 12, 2010

the product of its integers. For example, let consider (6, 3, 1, 2). We need to find these

products : 6 * 3 * 1 = 18 6 * 3 * 2 = 36 3 * 1 * 2 = 6 6 * 1 * 2 = 12| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersHow would you determine if someone has won a game of tic-tac-toe on a board of any size?

- gullu September 12, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerGiven two sequences of items, find the items whose absolute number increases or decreases

- gullu September 12, 2010

the most when comparing one sequence with the other by reading the sequence only once.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersHow many different binary trees and binary search trees can be made from three nodes that contain the

- gullu September 12, 2010

key values 1, 2 & 3?| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerGiven ships travel between points A and B, one every hour leaving from

- gullu September 12, 2010

both ends (simultaneously), how many ships are required (minimum), if the

journey takes 1hr 40 mts. How many ships does each ship encounter in its

journey, and at what times?

Ans 4, 3 at 20 mts, 50 mts and 80 mts.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Brain Teasers - 0of 0 votes

AnswersCount the number of set bits in a number without using a loop.

- gullu September 12, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerHow would you reverse the bits of a number with log N arithmetic operations, where N is

- gullu September 12, 2010

the number of bits in the integer (eg 32,64..)| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswerDelete a node from a binary tree and balance it. Write code for the former and explain the latter.

- gullu September 12, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersGiven a maze with cheese at one place and a mouse at some entrance, write

- gullu September 12, 2010

a program to direct the mouse to cheese correctly. (Assume there is a path).

Following primitives are given: moveforward, turnright, turnleft, iswall?,ischeese?, eatcheese.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer - 0of 0 votes

AnswersA car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from

- gullu September 12, 2010

Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B?| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Brain Teasers - 0of 0 votes

AnswersWrite a program to print the elements of a very long linked list in ascending order.

- gullu September 12, 2010

There may be duplicates in the list. You cannot modify the list or create another one.

Memory is tight, speed is not a problem.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersThere are set of ip address set of the form

- gullu September 12, 2010

10.10.10.10 - 20.20.20.20 -> cable, USA

20.20.20.21 - 33.32.31.30 -> DSL, Germany

.

.

.

250.250.250.250 - 256.256.256.256 -> cable, France

Which indicates all ip addresses between 10.10.10.10 to 20.20.20.20 are of type ‘cable’ and belong

to the country USA, similarly with other ip address set.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersGiven an array in which elements are unsorted. Write an algorithm that gives two indices n1,n2 such

- gullu September 12, 2010

that if you sort just the elements of the array from n1 to n2, then the whole array will be sorted.| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

Answersgiven a word,convert it into a pallindrome with minimum addition of letters to it.letters can be added anywhere in the word.for eg if yahoo is given result shud be yahoohay.give a optimize soln

- jj August 25, 2010| Report Duplicate | Flag | PURGE

Yahoo Developer Program Engineer Algorithm - 0of 0 votes

AnswersWhat is Spring IOC?

- aquila.25 February 27, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Java - 0of 0 votes

AnswersWhat is a deadlock and what are some of the ways to avoid a deadlock?

- aquila.25 February 27, 2010| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Threads - 0of 0 votes

AnswersFind the maximum subsequence sum of an array of integers which contains both positive and negative numbers and return the starting and ending indices within the array.

- kcoder December 18, 2009

For example:

int array[] = {1, -2, -3, 4, 5, 7, -6}

The max subsquence sum is 4+5+7= 16 and start index is at 3 and end index is at 5.| Report Duplicate | Flag | PURGE

Bloomberg LP Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersHow can we traverse through all the files in a folder and the subfolders. What system calls should be used(in C).

- msk December 12, 2009| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer

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