Software Engineer / Developer Interview Questions
- 1of 9 votes
Answers9 identical balls. one ball is heavy. find the heavy ball with only 2 measurements ........ dead easy.
- shakib034 October 27, 2013 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Brain Teasers - -1of 1 vote
AnswersGiven: left bottom and right top coordinates of a rectangle.
- code123 October 27, 2013 in India
n numbers of rectangle ceated holes.Find the area of holes.
eg.one rectangle in in top ,second intersect with the first at right and simillarly third at left and forth at bottom.It creates a hole in between.Find the area of the hole.| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Algorithm - -9of 9 votes
Answerssolve (x-1)(x-9)=8;
- code123 October 27, 2013 in India| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Algorithm - 0of 0 votes
Answersthere are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win.
- code123 October 27, 2013 in India
Note:In case the number of stick is equal ,pick the stick from the higest numbered box.
eg: 3 box contain stick as:1,1,1.
if u take 1 stick from 3rd numbred box you will any how win the match.| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Algorithm - 0of 2 votes
AnswersCheck if a given tree is a valid BST
- tbag October 26, 2013 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 2of 2 votes
AnswersEngineers at Google have decided to call any integer (+ve, -ve or 0) that is divisible by at least one of the single digit primes (2, 3, 5, 7) as Walprimes. Thus -21, -30, 0, 5, 14 etc are Walprimes, while -121, 1, 143 etc. are not Walprimes.
- geekofthegeeks October 26, 2013 in India
Now, consider a n-digit integer d1d2d3..dn. Between any 2 consecutive digits you can place either a (+) sign, a (-) sign or nothing. So, there are 3n-1 different expressions that can be formed from it. Some of the expressions so formed may evaluate to a Walprime. For example, consider the 6 digit integer 123456: 1 + 234 - 5 + 6 = 236, which is a Walprime, but 123 + 4 - 56 = 71, which is not a Walprime.
Your task is to write a program to find the no. of expressions (out of the possible 3n-1 expressions) that evaluate to a Walprime, for a given input. Note that leading zeroes are valid. For example, if the input is 1202004, it can be split as 12 + 020 - 04 etc. Also, the input itself can contain leading zeroes.
Input format: (Read from stdin)
The first line of input contains a single integer 'T' denoting the no. of test cases.
Each of the following 'T' lines contain a single string 's' (of length 'n') denoting an input for which you need to find the no. of valid expressions evaluating to a Walprime.
Output format: (Write to stdout)
Output exactly 'T' integers (one per line), where the ith line denotes the no. of valid expressions that evaluate to a Walprime for the ith input string. Since the output can be large, print all the quantities modulo 1000000007.
Sample testcase:
Input:
2
011
12345
Output:
6
64
Explanation:
For the first test case, s = "011". There are 32 = 9 valid expressions that can be formed from this string, namely {0+11, 0-11, 0+1+1, 0+1-1, 0-1+1, 0-1-1, 01+1, 01-1, 011} . Out of these 9 expressions, only the following 6 of them evaluate to a Walprime: {0+1+1, 0+1-1, 0-1+1, 0-1-1, 01+1, 01-1}.
Constraints:
There are 3 data sets.
For the first data set (5 points) -
1
For the second data set (10 points) -
1
For the third data set (15 points) -
1| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - -5of 5 votes
AnswerWhy do you think the company has been named so?
- geekofthegeeks October 26, 2013 in United States| Report Duplicate | Flag | PURGE
Tribal Fusion Software Engineer / Developer - -3of 3 votes
AnswersQ1. What Data structure would you use if you have to store millions of numbers.
- himanshu October 26, 2013 in India| Report Duplicate | Flag | PURGE
Nextag Software Engineer / Developer Data Structures - 4of 4 votes
AnswersWAP a program to find a contineous subset whose sum is divisible by 7. We are given a array of number (negative+positive).
- yogi.rulzz October 26, 2013 in India
calculate the complexity of your algorithm| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - -1of 1 vote
AnswersGiven a catalog of books, with the following attributes
- it_code October 26, 2013 in India
Name
Author
Publisher
Publisher Year
Price
Inventory count
Implement functionality for
1. get / search all books (by author/by name/by publisher) Also need to support partial string search
2. Update catalog (book)
Features:
* Explain why you use a particular data structure.
* Free to choose any language, C/C++/C#/Java/Perl/Python.
* Need to design the classes appropriately, that can allow scalability, encapsulation.
* Need to allow search similar to that currently provided by Flipkart.
Code in around 1 hour.| Report Duplicate | Flag | PURGE
Flipkart Software Engineer / Developer Data Structures - 0of 2 votes
AnswersAn array of integer represents a bar graph, where index of array is X axis (width = 1) and Y axis represents height of the bar graph at X, find out how much water will retain if it rains infinite on the structure. Only portion of graph that retains water is enclosed area due to height difference of bar graph. You need to assume that each bar itself doesn't store any water.
- mithya October 25, 2013 in United States
e.g. {1,2,3} then no water is stored
{6,4,1} then no water is stored
{3,2,1, 5} then 3 unit water is stored between 3 & 5 (1 unit on 2 and 2 unit on 1)| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven a dictionary of words, return words that can be formed by using only symbols from Chemistry Periodic Table.
- mithya October 25, 2013 in United States
e.g. ARK (Ar-K)
SICK (Si-C-K) etc.
(All the time while writing the code, I was just thinking about Br-Ba :) )| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 3of 11 votes
AnswersGiven a binary representation of an integer say 15 as 1111, find the maximum longest continous sequence of 0s. The twist is it needs to be done in log N. I could think of O(N) solution. but couldn't go for log(N).
- TapeRecordia October 24, 2013 in United States
For example. 10000101
the answer should be 4, because there are 4 continouos zeroes.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - -1of 3 votes
AnswersFor a given map (ie Bing map) given longitude/latitude/ how would you design the system so that when map longitudeDelta/latitdueDelta changed you add additional pins on map for regions that was not previously cover.
- chocoboman October 24, 2013 in United States
In another word, how would you design it to avoid getting and displaying duplicated pins| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Object Oriented Design - -3of 3 votes
Answers4 individual numbers which could be permuted in 4 factorial ways. permutation of these 4 integers is an 0indexedarray consisting of 4 digits in some order when integers are different. the best permute of the 4 integers is by the following funciton func(summ) = abs(summ[0] - summ[1]) + abs(summ[1] - summ[2] + abs(summ[2] - summ[3])) that would give maximum value.
- TapeRecordia October 24, 2013 in United States
method signature
public int answer(int w, int x, int y, int z){
}
w = 5
x = 3
y = -1
z = 5
the sample permute wiht given numbers in the given function that would give maximum value is as follows.
for the
summ[0] = 5
summ[1] = -1
summ[2] = 5
summ[3] = 3
This should be done in O(1)time ans space complexity. My questions wordings may be confusing, but the function and sample data are perfectly correct.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGive N=no. of players
- arpitbaheti7 October 24, 2013 in India
K=No. of fans
likeMatrix=It is a sting array of size K where each element of array have size N.
(contains 0 and 1 only) where if a[i][j] ==1 represents fan(i) likes player(j)
Ex. N=5
K=3
like={ "10101","00001","01011","...","...." }
Count min. no. of players required to put in team such that each fan likes atleast one player.| Report Duplicate | Flag | PURGE
Directi Software Engineer / Developer - 3of 13 votes
AnswersIn a language, there are only 4 characters ‘h’, ‘i’,’r’, ‘e’. and we have to write a function which takes a string as input and returns whether the given input string is a “valid word” or not.
- hugakkahuga October 23, 2013 in India
Definition of valid word :
1. A given word is a valid word if it is of the form h^n i^n r^n e^n where n >=1. (eg: hhiirree)
2. Valid words has concatenation property i.e. if w1 and w2 are valid words w1w2 is also a valid word.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSuppose the sub-requests can be queued at each server, and the servers are running all the time. Discuss feasible on-line algorithms that can achieve sub-optimal solutions with N ~ 10000.
- wayne October 23, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - -1of 1 vote
AnswersA service system has n DIFFERENT servers; each one provides one unique service to the clients. Clients submit requests to the service system, each request may have multiple sub-requests; each sub-request is to a DIFFERENT server. A request can have at most n sub-requests. Each sub-request takes 1 time unit to finish at any server. The finish time of a request is the finish time of its LAST finished sub-request. The notation "total request finish time" is the sum of all requests' finish time.
- wayne October 23, 2013 in United States
1. Design an off-line algorithm to reorder the execution order of sub-requests on the servers, so that "total request finish time" can be minimized (if multiple solutions exist, only one solution is enough). Discuss the complexity of the algorithm.
Input format:
Line 1: number of requests.
Line 2: number of servers in the system, n.
Line 3 to (n+2): sub-requests (denoted with their parent requests’ IDs) at each server, the i’th line represents the sub-requests to be served at server ID = (i-2).
Output format:
Line 1 to (n-1): the execution order of sub-requests, so that “total request finish time” can be minimized.
Sample input 1:
4
4
1 2 3 4
3 2 1 4
4 2 1 3
2 3 4 1
Sample output 1:
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
(The “total request finish time” of input is 14; and output is 10).
Sample Input 2:
6
6
1 6 2
4 3 5 1
1 2
1 2 4 6
3
5 6
Sample Output 2:
6 1 2
3 1 4 5
1 2
6 1 4 2
3
6 5
(The “total request finish time” of input is 19; and output is 15).
2. Discuss feasible algorithms that can achieve sub-optimal solutions with N ~ 10000.
3. Suppose the sub-requests can be queued at each server, and the servers are running all the time. Discuss feasible on-line algorithms that can achieve sub-optimal solutions with N ~ 10000.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - -5of 5 votes
AnswersWhat is the in order successor of 6 in the given BST? (Ah! This is not an assignment. I am a working professional).
- Gaile October 22, 2013 in United States
4
2 6
1 3 5
4.5 5.5
2 is left child of 4 and 6 is right child of 4.
1 is left child of 2 and 3 is right child of 3.
5 is left child of 6.
4.5 is left child of 5 and 5.5 is right child of 5.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - -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 - 2of 10 votes
AnswersHow many times “Hello World” is printed by following program?
- whatsmyname1993 October 22, 2013 in India
int main()
{
if(fork() && fork())
{
fork();
}
if(fork() || fork())
{
fork();
}
printf(“Hello world”);
return 0;
}
a. 16
b. 20
c. 24
d. 64| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Operating System - -1of 1 vote
AnswersWrite a function to retrieve the number of a occurrences of a substring(even the reverse of a substring) in a string without using the java substring() method.
- girishreddy5 October 22, 2013 in United States
Ex: 'dc' in 'abcd' occurs 2 times (dc, cd).| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 2of 2 votes
AnswersGiven an input list of lists.. flatten the list. For e.g.
- techpanja October 22, 2013 in United States for yammer
{{1,2}, {3}, {4,5}} ... Output should be {1, 2, 3, 4, 5}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 2of 2 votes
AnswersFind the max height of a binary tree.
- techpanja October 22, 2013 in United States for yammer| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 3of 3 votes
AnswersWrite your own regular expression parser for following condition:
- techpanja October 22, 2013 in United States for yammer
az*b can match any string that starts with and ends with b and 0 or more Z's between. for e.g. azb, azzzb etc.
a.b can match anything between a and b e.g. ajsdskjb etc.
Your function will have to parameters: Input String and Regex. Return true/false if the input string satisfies the regex condition. Note: The input string can contain multiple regex. For e.g. az*bc.g| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersGiven a array of numbers, for each element give the product of every other number. eg 1 2 4 3--> 24 12 6 8
- kool.human October 21, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - -2of 4 votes
AnswersFind the first repeating character in a given string.
- kool.human October 21, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 6 votes
AnswersHow to find if a number is power of 4 in O(loglogn).
- AVK October 21, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - -1of 5 votes
AnswersFind if 2 lists of rectangle are exactly equal. How would you sort the lists?
- chandeepsingh85 October 21, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Graphics