Software Engineer / Developer Interview Questions
- 0of 0 votes
AnswersR2 | Q2. You have a dictionary of words. Given a word, print all anagram are in dictionary . State the data structure to be used to solve this problem.
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 2:(1.h 15min)
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
===================
Q1. Given a sorted array having duplicate elements,how would you find first index of a given element in O(nlogn).
Write code for it. Change the condition to find out last index of that elements.
[ Hint Binary search]| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - -2of 2 votes
AnswersR1 | Q2. Find an element in a sorted rotated array in O(nlogn ) complexity.
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 1: (1 h)
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
==============
Q1. Design a Garbage collector like java. How would you detect depended reference loop ?
Hist : Class design, Cycle detection algorithms for disjoint graph( List of connected graph)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 3of 3 votes
AnswersWrite an algorithm to find the ‘next’ node (e.g., post-order successor) of a given node in a binary tree and binary search tree
- Jeff May 18, 2014 in United States
a.) where each node has a link to its parent.
b.) without parent pointer
implement 2 versions of the algorithm: 1.) binary tree 2.) BST| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 0 votes
AnswersEndian conversion little - big endian
- croox_shil May 18, 2014 in India| Report Duplicate | Flag | PURGE
Alcatel Lucent Software Engineer / Developer C# - -1of 1 vote
AnswersWAP , In SLL delete nth node from end.
- croox_shil May 18, 2014 in India| Report Duplicate | Flag | PURGE
Alcatel Lucent Software Engineer / Developer Linked Lists - -1of 1 vote
Answersstruct st{
- croox_shil May 18, 2014 in India
int a;
char *ptr;
}obj;
assign : a=10;
ptr="Hello world";| Report Duplicate | Flag | PURGE
Alcatel Lucent Software Engineer / Developer Data Structures - -1of 3 votes
AnswersThere is a byte array which contains the character of one byte and two bytes. One byte character has range 0 to 127 and first character of 2 byte character is 128 to 255 and second byte character has range 0 to 255. Now, two pointers are given, one points to the start of the and another points to somewhere else.
- !@# May 16, 2014 in India
Tell which character 2nd pointers points to?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersi) Explain Polymorphism
ii) Output of the below code snippet :-
- hulk May 15, 2014 in Indiapublic class ParentTest { public int x = 0; public void print() { System.out.println("In Parent"); } } public class ChildTest extends ParentTest { public int x = 1; public void print() { System.out.println("In Child"); } public static void main( String args[] ) { ParentTest s = new ChildTest(); System.out.println(s.x); s.print(); } }
| Report Duplicate | Flag | PURGE
Morgan Stanley Software Engineer / Developer Java - 1of 1 vote
AnswersGiven the following linked list: 1 -> 2 -> 3-> 4-> 5-> 6 reverse the list each N nodes. eg. if N = 3 the output should be 3-> 2-> 1-> 6-> 5-> 4. Also provide a mechanism to prevent errors. For the same example, if N = 4, the result should be: 4-> 3-> 2-> 1-> 5-> 6 (The last two nodes can't be reversed)
- NL May 14, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a set of 21 tasks = {A, B,....Z} except I, O, U, X and Q. Each task requires 4 hours of processing. Except for tasks E, Y, P, R, W that require 8 hours of processing.
- foobar May 14, 2014 in United States
You have 3 machines to process these tasks = T1, T2, T3. T1 and T2 are available everyday for 8 hours. T3 is available only on Mon, Wed and Fri for 8 hours.
You are given 3 lists that indicate the dependency list among the tasks.
L1 = A->R->K->M (eg A can be completed if R is completed, R can be completed only if K is completed etc.)
L2 = N->G->V->E->Z->H
L3 = C->F->Y->D->J->P->T->S->W->B->C (cycle)
Each task needs one machine for its duration to complete.
Tasks cannot be resumed. Which means the 8 hour tasks cannot be executed over 2 days.
Each machine can process only one task at any time.
T1, T2 and T3 can process different tasks in parallel.
You are starting your schedule on a Wednesday.
Machines can be scheduled only during weekdays.
The first Monday in your schedule is a downtime for all the machines.
Given these constraints, write a program that generates a schedule between the tasks and machines such that all the tasks are completed at the
earliest.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm C++ Coding - 2of 2 votes
AnswersConsider sorted singly linked list having following nodes
- msgambhir May 12, 2014 in United States
10->30->50->70->NULL
You are given pointer to node 50 and a new node having value 40. Can you inserted node 40 correctly in the list maintaining the ascending order?| Report Duplicate | Flag | PURGE
Qual Ex Software Engineer / Developer Linked Lists - 2of 2 votes
AnswersGiven a linked list: 5 -> 4 -> 3 -> 2 -> 1, produce the following output: 4 -> 2 -> 0 -> 2 -> 1 by substracting the 1st node with nth node, the 2nd with nth -1 node, etc... Only apply the stated action on the first half of the list
- NL May 11, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Coding - 0of 2 votes
AnswersWrite a program to count the number of numbers between two numbers a, b that have the sum of their bits equal to a fibonacci number.
- hulk May 11, 2014 in India
For example between 15 and 17 there are two numbers that have sum of bits equal to a fibonacci number.
15: 1111 sum=4
16: 10000 sum=1 (fibonacci)
17:10001 sum=2 (fibonacci)
So the output will be 2 in this case.
Test case -
Input 15 & 17
Input 173 & 10000003210005
The interviewer asked this to code in 5 hours in any programming language & mail him the full working program.| Report Duplicate | Flag | PURGE
Vdopia Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a program to output the number of consecutive trailing zeros in the factorial of a number?
- hulk May 11, 2014 in India
For example:-
Input - 5!
Output - 1 (Since 5! = 120 & 120 has 1 trailing zero in the end)| Report Duplicate | Flag | PURGE
Jabong Software Engineer / Developer Algorithm - 1of 1 vote
AnswersWrite a function to return a path from a given node of a Binary tree to the node on its right.
- 14mit1010 May 10, 2014 in India
Each node contains a left pointer, a right pointer and a parent pointer
The root node is not provided, the tree is not balanced, the tree is not a Binary search tree
Finding the root node and running BFS from there is not an acceptable solution. You have 30 minutes to give syntactically correct code
I was unable to complete this question and was rejected without further interviews. Perhaps I did something to offend the interviewer, this was for an entry level SDE position| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 4 votes
AnswersGiven a matrix of size N*N and a starting point "s" in the matrix which represents a color.
Find the area of the shape represented by the color of the starting point "s".
Note 1: A shape can be anything as long as it is connected, e.g. a square, a circle, a doughnut or a line.
Note 2: It is only a shape if they are connected from the starting point.
Note 3: Connected means, adjacent and the same color.
E.g.zero based index. Starting point = top left "R" [3][2], color = R, area = 10 000000000 000000000 000000000 00RRRR000 00R00R000 00RRRR000 000000000 000000000 000000000
Update: OK as requested further clarifications, a cell is only a single color, it is a matrix and contains
a single value stating the color of the cell. Think of each cell as a pixel and each pixel represents a length of 1.
The shape above has an area of 10, because that it is not a regular square but has two holes in the middle, if you do it mathematically:
(3*4) - (1*2) = 10 or simply by visually counting the R squares.
You are not trying to create shapes, you are using the starting point "s" to find the complete shape (traverse the matrix until you have found all connected pixels) and calculate the area.
If you need more clarification I can try but I think that should clarify.
State your Time and Space complexity of your algorithm.
Consider also this:0000000000000 0000000000000 0000000000000 0000000000000 0000000000000 00RRRR0000000 00R00R000RR00 00RRRR000RR00 0000000000000 0000000000000 0000000000000 0000000000000 0000000000000 zero based index. Starting point s = top-left "R" [5][2], area = 10.
In the above case, the other shape, same color is not connected to the shape specified by the starting point, hence is not part of the area calculation.
- DotQ May 09, 2014 in United States
Apologies for the formatting.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven a mathematical expression, remove the redundant brackets from the expression.
- !@# May 08, 2014 in Indiae.g. input: (a + (b*c)) * (d * ( f * j) ) output should be: (a + b * c) *d * f * J
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - -6of 6 votes
AnswersHow to delete two rows from the table in database ?
- ajaybhardwaj789 May 07, 2014 in India
Note: Delete only first two rows from the Database.
<table style="width:300px" border="2px">
<tr>
<th>USERNAME</th>
<th>LOCATION</th>
</tr>
<tr>
<td>zac</td>
<td>california</td>
</tr>
<tr>
<td>zac</td>
<td>california</td>
</tr>
<tr>
<td>zac</td>
<td>california</td>
</tr>
<tr>
<td>zac</td>
<td>california</td>
</tr>
</table>| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Database - 1of 1 vote
AnswersImplement LRU cache of size 10 which can store Key, Value pair. (get(key) & put(key,value) methods)
- Miral Patel May 07, 2014 in United States
- If we try to add 11th element, the least recently used element should get removed.
- If key already present, overwrite it and mark it as most recently used.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 3of 3 votes
Answerspublic class LogEntry {
- Invhelper May 05, 2014 in United States
public final long startTime; // start time of a job in millisec granularity
public final long endTime; // end time of a job in millisec granularity.
public final long ram; // the amount of ram the job occupies.
public final long jobId;
... constructor ...
}
running total of RAM
|
| 3GB
| -----
| 2GB
| ------
| 1GB -----------
|----- -----------
|
|____________________________________________________time
Find the peakRAM when the input is a collection of LogEntry objects| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 2 votes
AnswersGiven a string array ex: [1, 2, 3], find the permutation in best time.
- Invhelper May 05, 2014 in United States| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer Coding - -2of 2 votes
AnswersGiven 4 bottles out of which one is of less weight. Find out the defective one by weighing only once.
- Nascent May 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 2of 2 votes
AnswersGiven MxN matrix which contains 1s and 0s, find the largest sub matrix which contains most number of 1s. condition is that each row in the sub matrix must contain at-least one 1.
- Nascent May 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - -5of 7 votes
AnswersFlood fill algorithm. He also asked me what else I would do before checking the code to repository?
- snigda.2000 May 03, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 4of 4 votes
Answersgive an algorithm for finding duplicate parenthesis in a expression.
example :
- rahul May 02, 2014 in United States(( a + b ) + (( c + d )))
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - 1of 1 vote
Answersgive an algorithm for finding duplicate parenthesis in a expression.
- rahul May 02, 2014 in United States
{{ (( a + b ) * (( c + d ))) }}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - 0of 0 votes
AnswersHe asked me to print root to leaf path WITHOUT using recursion . I got stuck at it and used too much space according to him .
- !@# May 02, 2014 in India
I constructed a visited array , path array and a stack .
Is there any other optimal algorithm ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Trees and Graphs - 1of 1 vote
Answersa[] is an array containing elements of a BST .
- rahul May 02, 2014 in India
2D array is given where arr[i][j] gives the root of the tree formed by taking elements from index i to j from a[] . construct the BST .| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Trees and Graphs