SDE-2 Interview Questions
- 0of 0 votes
AnswersGiven following definition, implement hashmap
- juny December 12, 2013 in United States for TrafficPublic class HashMap { Public void put(object key, object value); Public void get(object value); }
| Report Duplicate | Flag | PURGE
Ebay SDE-2 Hash Table - 1of 1 vote
AnswersGiven a sorted array with duplicates, move the distinct elements to the top
- juny December 12, 2013 in United States for Traffic
Ex: 1,1,2,3,4,4,5 -> 1,2,3,4,5| Report Duplicate | Flag | PURGE
Ebay SDE-2 Arrays - 0of 0 votes
AnswersFor a given string of some sentence, reverse words in that sentence. Ex: I am Don..return Don am I.
- Razz December 07, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersFor given set of natural number, suppose we can negate some number. Find what all number we should negate such that sum of all number (after negating some number) is zero. For ex: {1,2,3} return {-1, -2}, {1,2,3,4} return {-1,-4} or {-2,-3}. 1st check if such number in given set exist or not. If not return empty array else return numbers.
- Razz December 07, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 3of 3 votes
AnswersGiven two log files, each with a billion usernames (each username appended to the log file), find the usernames existing in both documents?
- Madan December 04, 2013 in United States| Report Duplicate | Flag | PURGE
Google SDE-2 - 1of 1 vote
AnswersEveryone knows that finding a loop in the single linked list is using runner and follower method. Could you provide mathematical proof of correctness for it and why it works. I said something like induction hypothesis. Someone help me with the correct answer.
- Madan November 27, 2013 in United States| Report Duplicate | Flag | PURGE
Google SDE-2 Algorithm - 0of 0 votes
AnswersList of parent and child of a binary tree are given in the format (parent, child) –> (p1,c1) (p2,c2) etc [ie, binary tree represented by adjacency list]
- Vin November 27, 2013 in India
How to check "loop" exists in this binary tree or not efficiently.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - -1of 1 vote
AnswersList of parent and child of a binary tree are given in the format (parent, child) –> (p1,c1) (p2,c2) etc [ie, binary tree represented by adjacency list]
- Vin November 27, 2013 in India
How to check "loop" exists in this binary tree or not in efficiently.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 2 votes
AnswersHow will you find if a string is a substring of another string in O(n) complexity. For example, "tl" is substring of bottle.
- Madan November 26, 2013 in United States| Report Duplicate | Flag | PURGE
Google SDE-2 Algorithm - 0of 0 votes
AnswersYou are given pairs of numbers. In a pair the first number is smaller with respect to the second number. Suppose you have two sets (a, b) and (c, d), the second set can follow the first set if b<c.So you can form a long chain in the similar fashion. Find the longest chain which can be formed
- Rahul Sharma November 26, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersSuppose we have two functions void g() and void h(). The function h() has been called somewhere in the body of g(). Now using a debugger, we find that that the program crashes as soon as the return statement in h() ( at the end of function h() ) is executed. There is nothing syntactically wrong with the program. How will you debug the code ?
- Rahul Sharma November 25, 2013 in India| Report Duplicate | Flag | PURGE
Adobe SDE-2 Compiler - 0of 0 votes
AnswersDNA sequence(a string) is given (let say strDNA) and another string to search for(let say strPat). You have to find the minimum length window in strDNA where strPat is subsequence(Write code).
- Rahul Sharma November 23, 2013 in United States| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Algorithm - 3of 3 votes
AnswersSuppose you are supplied with a file containing a list of words like ABC, BCD , CAB ( say each word in new line ). now you have to suggest algorithm for this problem -
- ajitpec November 21, 2013 in India
When a user type some character, we have to suggest him next character and basis of suggestion is that the character you are going to suggest should have maximum occurrence at that position among all these words.
For example , Let's say words are
ABC
BCD
CBA
Now if user types 'A' we have to suggest him 'B' as next character because if you see at second position in all words 'B' is occurring most number of times ( 2 times ).
similarly if he types 'AB' then we need to suggest him third character as 'C' as in third index all words have same occurrence but 'C' comes first.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 1of 1 vote
AnswersDesign a datastructure for the below functions.
- smashit November 20, 2013 in United States
void add(T elem);
void remove(T elem);
T elem removeRandom();
The operation time requirement : O(1)| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 11of 13 votes
AnswersGiven s string, Find max size of a sub-string, in which no duplicate chars present.
- sanjay05iitr November 10, 2013 in India for Cyllas Experience| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersFind a sub-sequence in a list of numbers where sum of sub sequence is maximum. Numbers can be positive or negative
- sanjay05iitr November 10, 2013 in India for Cyllas Experience| Report Duplicate | Flag | PURGE
Amazon SDE-2 Coding - 1of 1 vote
AnswersFind all the anagrams in a mail content.
- sanjay05iitr November 10, 2013 in India for Cyllas Experience| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 6of 6 votes
AnswersYou are given two string named str1 and str2. Your task is to find the minimum window in str1 which contains all characters from string str2.
- Rahul Sharma November 09, 2013 in India| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Coding - 2of 2 votes
AnswersThere is a sentence that your friend knows, but while giving it to you, he lost all the spaces. You have a dictionary with you, that will tell you given word exist or not. How would you reconstruct the original sentence using it.
- Vin October 23, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - -2of 8 votes
AnswersAs we know facebook always asks questions from graph theory he asked me this problem to code-
- Rahul Sharma October 12, 2013 in India
there is a grid of n*n where each cell represent an Island or and some of these are very dangerous so u have to avoid these during path selections.You can move up,down,left ,right.You are given your starting position ,positions of dangerous Islands and position some specific Islands.Your task is to deliver a message to all the specific Islands in minimum number of moves to all specific Islands(NOTE- there are also chances that no moves are possible to cover all specific Island ,in such case you have to tell "NOT POSSIBLE TO DELIVER ALL ",otherwise output minimum moves).| Report Duplicate | Flag | PURGE
Facebook SDE-2 Algorithm - 0of 2 votes
AnswersWrite code to print all different paths in an undirected graph from a given source to destination with no loop(any node can be at most once in a path ).
- Rahul Sharma October 11, 2013 in India| Report Duplicate | Flag | PURGE
Facebook SDE-2 - 0of 4 votes
AnswersGiven a undirected graph, source and destination, write the code to find the total number of distinct nodes visited, considering all possible paths.
- Rahul Sharma October 09, 2013 in India| Report Duplicate | Flag | PURGE
Facebook SDE-2 Algorithm - 0of 0 votes
AnswersHow would you assign numbers if you were AT&T, describe a data structure
- juny October 07, 2013 in United States for Azure| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Data Structures - 0of 0 votes
Answersif two digonals of co-ordinates are given then if two rectangles are overlap then return true otherwise false
- kumar.prince6 September 30, 2013 in India| Report Duplicate | Flag | PURGE
SDE-2 - 0of 0 votes
AnswersDesign a class for Game of card. You can use any design pattern or data structure.
- Razz September 26, 2013 in India
1. There are 52 card.
2. There are 4 suits, each contain 13 cards.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 0of 2 votes
AnswersGiven a tree (not necessary a Binary Tree) print (draw) the tree in original structure with proper formatting.
- Rahul September 20, 2013 in India| Report Duplicate | Flag | PURGE
Google SDE-2 Algorithm Data Structures - 4of 6 votes
AnswersFind the nearest leaf node from given node in binary tree.
- Vin September 08, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - -1of 7 votes
AnswersFind maximum product of subarray in given array of integers
- Vin September 08, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 1 vote
AnswersDesign T9 dictionary
- Vin September 08, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2