Yahoo Interview Questions
- 2of 2 votes
AnswersYahoo Sunnyvale onsite
- aonecoding May 28, 2018 in United States
A string s3 consists of multiple repetitions of s1.
Given s1 and another string s2, find if s2 is a substring of s3.
s3 = s1 + s1 + … + s1 = n * s1, where n is a positive integer 0.
For example
s1 = “aabc”, s2 = “caa” => true
s1 = “aabc”, s2 = “cab” => false
s1 = “aabc”, s2 = “caabcaa” => true| Report Duplicate | Flag | PURGE
Yahoo Software Engineer Algorithm - 0of 0 votes
AnswersWrite a merger and separator for Linked List.
- Shilpi_Roy November 02, 2017 in United States
eg: 1->2->3->4->5
separator()
1->3->5 and 2->4
merger()
1->2->3->4->5| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Data Structures - 1of 3 votes
AnswersGiven array of length n, having element 0 to n-1.
- DATA April 11, 2017 in United States
you are allowed to swap adjacent element only if Absolute difference of two element is equal to 1.
Is it possible to sort array.
If yes print sorted output.| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Arrays Data Structures Math & Computation Online Test - 0of 0 votes
Answer2.{{ Query the sum of all the data values in a given rectangle (x1,y1) ~(x2, y2).
- mannurujava January 07, 2017 in United States
int querySum(int x1, int y1, int x2, y2) {}}}| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Algorithm - 0of 0 votes
Answer{{Given a two dimensional grid that stores data as integers with the size of N*M, implement write and query functions which supports:
- mannurujava January 07, 2017 in United States
1. Write the given value to designated coordination (x, y).
void write(int value, int x, int y) {}
}}| Report Duplicate | Flag | PURGE
Yahoo Backend Developer Algorithm - 0of 0 votes
AnswersGiven a nxn matrix, with partially filled cells of numbers from 1..n and the rest with 0's. Fill the cells such each row and column has numbers 1 to n without any repetition.
- faizvf November 14, 2016 in United States
Eg:
[
[1, 2, 0],
[0, 1, 0],
[0, 0, 1]
]
[
[1, 2, 3],
[3, 1, 2],
[2, 3, 1]
]| Report Duplicate | Flag | PURGE
Yahoo SDE1 Algorithm - 0of 0 votes
AnswersWhat is indexing in a database?
- teli.vaibhav October 30, 2016 in United States
What are the underlying data structures you think are involved in indexing of a database?
What are some upsides and downsides of using indexing?| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an array of integers. Find the surpasser count of each element of the array.
- teli.vaibhav October 30, 2016 in United States
"A surpasser of an element of an array is a greater element to its right"
ex -
Input: [2, 7, 5, 3, 0, 8, 1]
Output: [4, 1, 1, 1, 2, 0, 0]| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven an array of integers and a sum 'S'. Find 2 integers in the array that add up to S.
- teli.vaibhav October 30, 2016 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind the first unrepeated character in a given string. Solve this in a single pass.
- teli.vaibhav October 30, 2016 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 2 votes
AnswersWhat is RESTful design.
- coLiguanda October 08, 2016 in Cananda| Report Duplicate | Flag | PURGE
Yahoo Intern Web - 3of 3 votes
AnswersGiven a String find the first non repeating char in a single pass of the string.
- um01 April 18, 2015 in United States
Assume a big character set like utf-8 (eleminate use of char[256])
Avoid any subloop to have a very optimal solution| Report Duplicate | Flag | PURGE
Yahoo SDE1 Algorithm - 1of 1 vote
Answerswrite custom pattern match function to match following logic
.’ Matches any single character.
‘*’ Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
- storb99 April 07, 2015 in United Statesbool isMatch(const char *s, const char *p) Some examples: isMatch(“aa”,”a”) → false isMatch(“aa”,”aa”) → true isMatch(“aaa”,”aa”) → false isMatch(“aa”, “a*”) → true isMatch(“aa”, “.*”) → true isMatch(“ab”, “.*”) → true isMatch(“aab”, “c*a*b”) → true isMatch(“ccca”, “c*a”) → true
| Report Duplicate | Flag | PURGE
Yahoo Software Engineer Coding - 1of 1 vote
AnswersGiven an array of n integers, return the maximum PMEAN of all possible array rotations, where PMEAN = the sum of each integer multiplied by its current location (index + 1). For example: The PMEANs for every rotation of the array {20, 30, 10} are: PMEAN1 = (1 * 20) + (2 * 30) + (3 * 10) = 110 PMEAN2 = (1 * 30) + (2 * 10) + (3 * 20) = 110 PMEAN3 = (1 * 10) + (2 * 20) + (3 * 30) = 140 The max PMEAN of array {20, 30, 10} is 140.
The question is simple enough. I was able to get a working algorithm quick enough, but I failed to optimize my answer.
- Sydney February 19, 2015 in United States
Hint from the interviewer:
If you have PMEANn, how can you use the result to get PMEANn+1?| Report Duplicate | Flag | PURGE
Yahoo Software Engineer - 0of 0 votes
AnswersIEEE float to IBM float value conversion
- gsuit123 February 03, 2015 in United States| Report Duplicate | Flag | PURGE
Yahoo Developer Program Engineer - 0of 0 votes
AnswersBuild a function that takes one string and one regex expression in inputs and output true if the string matches the regex expression.
- shankhs November 16, 2014 in United States
string: a-z
regex: a-z + * (where '*' matches 0 or more character and '+' matches one character)| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 2of 2 votes
AnswersGiven a set of equalities and inequalities like A=B,B=C,F=J and A!=C, etc in two separate arrays (equalities[] and inequalities[]) and a method, separate that returns the two objects, e.g. separate(A=B) will return A and B, write an algorithm to find whether the entire set is consistent in constant time.
- addy October 25, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo SDE1 Algorithm - 0of 0 votes
Answerswhat all design patterns are used in designing a shopping cart and explain?
- User August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Coding - 0of 0 votes
AnswersHow do you normalize shopping cart tables?
- User August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Database - 0of 0 votes
AnswersPassword storage rather than storing in DB.
- User August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Database - 0of 0 votes
AnswerHow the tables are stored(different tables structure)
- User August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Database - 0of 0 votes
AnswersDesign a shopping cart.
- User August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Java - 0of 0 votes
Answerswhile(scanf("%d,",&a)) { //store a as you wish to }
Input given is : 1,2,3,4,5,6,7,8,9
while(scanf("(%d,%d),",&a,&b)) { //store a and b as you wish to
}
- gdg August 13, 2014 in United States
Input given is : (1,5),(8,11),(3,6),(10,20)
EXPLAIN INTERNAL WHOLE MECHANISM IN BOTH CASES| Report Duplicate | Flag | PURGE
Yahoo - 1of 1 vote
AnswersGiven a binary tree, change the value in each node to sum of all the values in the nodes on the left side of the node.
- gdg August 07, 2014 in United States
Eg 1
/ \
2 3
3
/ \
2 6
solved this question using int* he asked me to do it without integer pointer.| Report Duplicate | Flag | PURGE
Yahoo - 0of 0 votes
AnswersAn array contain 6 different numbers, only 1 number is repeated for 5 times. So now total 10 numbers in array, Find that duplicate number in 2 steps only?
- gdg August 03, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo - 0of 0 votes
AnswerYou are given a mxn grid arr[][] and you stand at cell arr[p][q]. In 1 'move' you can either go up, down , left or right. Tell the probability that after taking 'k' moves, you are still inside the grid.
CODE:
(Can you point out any mistake)
- gdg August 01, 2014 in United States#include <stdio.h> #include <stdlib.h> void traverse(int m, int n,int cur_x,int cur_y,int moves,int * in,int * tot) { if(moves==0) *tot = *tot+1; if(moves==0 && !(cur_x>=m||cur_y>=n||cur_x<0||cur_y<0)) *in = *in +1; traverse(m,n,cur_x,cur_y+1,moves-1,in,tot); traverse(m,n,cur_x+1,cur_y,moves-1,in,tot); traverse(m,n,cur_x,cur_y-1,moves-1,in,tot); traverse(m,n,cur_x-1,cur_y,moves-1,in,tot); } int main() { int m = 5, n = 5; int in=0,tot=0; int k,p,q; scanf("%d%d%d",&k,&p,&q); traverse(m,n,p,q,k,&in,&tot); printf("%d/%d ",in,tot); return 0; }
| Report Duplicate | Flag | PURGE
Yahoo - 1of 1 vote
AnswersFind the deepest node in a binary tree:
- 4661 July 11, 2014 in United States
Example:
A
/ \
B C
/ \ / \
D E F G
\
H
Return Node ‘H’| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 1of 1 vote
AnswersFind the deepest node in a binary tree:
- 4661 July 11, 2014 in United States
Example:
A
/ \
B C
/ \ / \
D E F G
\
H
Return Node ‘H’| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 1of 1 vote
AnswersWrite a function to remove the duplicated characters from a string, and maintain the order of the characters.
- 4661 July 11, 2014 in United States
ex. “abracadabra” ? “abrcd”| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm