Software Engineer / Developer Interview Questions
- 3of 3 votes
AnswersHow many occurrences of a given search word can you find in a two-dimensional array of characters given that the word can go up, down, left, right, and around 90 degree bends?
- lueikhong June 07, 2014 in Australia
Ex:
Count of occurrences of SNAKES
S N B S N
B A K E A
B K B B K
S E B S E
The answer is 3.
Write a program for that question.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a value (in double) return its square root.
- wolfengineer June 06, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 6of 6 votes
AnswersCode a function that receives a string composed by words separated by spaces and returns a string where words appear in the same order but than the original string, but every word is inverted.
Example, for this input string@"the boy ran"
the output would be
@"eht yob nar"
Tell the complexity of the solution.
- diegum June 06, 2014 in United States for iOS| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer String Manipulation - 2of 2 votes
AnswersDesign an HTTP downloader that caches results and doesn't block execution (i.e., enables simultaneous downloads).
- diegum June 06, 2014 in United States for iOS| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Object Oriented Design - 3of 3 votes
AnswersCode a function that gets two strings representing binary numbers (so the only possible characters are '1' and '0', and returns a third string representing the sum of the input. The input strings don't necessarily have of the same length.
- diegum June 06, 2014 in United States for iOS
Tell the complexity of the solution.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer String Manipulation - 2of 2 votes
AnswersCode a function that receives an array with duplicates and returns a new array keeping the original order of the elements but with the duplicates removed.
For example, if the input were@[ @"dog", @"cat", @"dog", @"fish" ]
the output would be
@[ @"dog", @"cat", @"fish" ]
Tell the complexity of the solution.
- diegum June 06, 2014 in United States for iOS| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven a binary tree, write a method to determine shortest distance between two nodes. A node does not have a pointer to its parent
- Serengeti June 03, 2014 in United States| Report Duplicate | Flag | PURGE
Spotify Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven a binary tree, write a method to determine shortest distance between two two nodes. The node does not have a pointer to its parent
- Serengeti June 03, 2014 in United States| Report Duplicate | Flag | PURGE
Spotify Software Engineer / Developer Coding - 1of 1 vote
AnswersGiven a graph, write a method to check if it is bipartite
- Serengeti June 03, 2014 in United States| Report Duplicate | Flag | PURGE
Spotify Software Engineer / Developer Coding - -1of 3 votes
AnswersQuest: create a Random number generator without using the java in build Random class?
- vrajendra.singh.mandloi May 31, 2014 in India
public class GenerateRandomNumbers {
public static int seed = 10;
public void generateInt(int num){
seed = num;
for(int i=1;i<num;i++){
seed = ((int)System.nanoTime()%(i));
if(seed<=0)
seed = ((int)System.currentTimeMillis()%i);
System.out.println(seed);
}
}
public static void main(String[] args) {
new GenerateRandomNumbers().generateInt(20);
}
}
its a class to generate random numbers but the problem is It always starts with 0...!
Can someone add some more to this code.??| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
Answer- there is a large filed (dimensions are specified)
- rahulgupta999 May 31, 2014 in India
- Given a list of rice varieties that can be grown on a square plots (of 2X2) in the large field.
- Given the dimensions of the large field we can find out the number of individual plots that can be cut out (rows and columns)
- Each variety has its own pollination period specified by start and end date.
- We have to assign plot to each variety such that there is no intersection in pollination period of neighbouring varieties.
- Neighbouring variety is the variety grown in the adjacent plot. Any plot can have a max of 8 neighbours
- The output is a 2D matrix representation, where each cell is a plot. Each plot is assigned at most one variety of rice.
- Each variety of rice can be assigned to at most one plot
- Maximise the number of varieties used. (minimise the number of vacant plots)
eg:
name,start_date,end_date
V1,11Sep,15Sep
V2,13Sep,20Sep
V3,1Oct,4Oct
V4,25Sep,30Sep
- it is ok if some plots are left empty
- no_of_rice_varieties <=1000| Report Duplicate | Flag | PURGE
StartUp Software Engineer / Developer Algorithm - -1of 1 vote
Answersgiven 10 files (text files) each of size of 900 Mb. givena another file named "hello". match the contents of this file with other 10 file and return the file whose contents closely match with the contents of file "hello"
- mad May 30, 2014 in India| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
AnswersImplement thread-safe circular queue that has 2 methods Read & Write n bytes.
- Goooogle2014 May 29, 2014 in United States for Azure
The entire design and implementation was open for discussion.
Discussion went for locking, multi threading, boundary cases, all sets of issues related to multi threading..it was quite intense..| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding - 0of 0 votes
AnswersYou are given several thousand - two member tuples of compatible entries.
- Alok May 24, 2014 in United States
Your goal is to find the longest list of compatible entries
i.e.
(a,b) => a is compatible with b
(b,d) => b is compatible with d
(d, e) => d is compatible with e
Longest list a,b,d,e| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
AnswersA matrix will be given which contains nos. and dots. will have to output another matrix in which the nos. are surrounded by single loop. the value of each number in a matrix equals the number of lines surrounding it.
- im.akki90 May 23, 2014 in India
Empty spaces in matrix/dots may be surrounded by any number of lines.
When completed, the solution forms a single continuous loop with no crossings or branches.
Value of each no. should connect the adjacent dots horizontally and vertically so that the lines form a simple loop with no loose ends based on the above rules.
eg
input Matrix
1.31.3
...3..
.3.21.
.02.1.
..2...
2.23.3
output Matrix
- -
1 .|3|1 .|3|
- - | - |
|. . .|3|. .|
| - - -
|.|3|. 2 1|.
- - - _
. 0 2 .|1 .|
- - - -
|.|.|2 . .|.
| - - -
|2 . 2|3|. 3|
- - - - -
i tried making rules and then call the function to make lines, but couldnt succeed in gettin desired output.
for any queries please comment| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Java - 0of 0 votes
AnswersA matrix will be given which contains nos. and dots. will have to output another matrix in which the nos. are surrounded by single loop. the value of each number in a matrix equals the number of lines surrounding it.
- im.akki90 May 23, 2014 in India
Empty spaces in matrix/dots may be surrounded by any number of lines.
When completed, the solution forms a single continuous loop with no crossings or branches.
Value of each no. should connect the adjacent dots horizontally and vertically so that the lines form a simple loop with no loose ends based on the above rules.
eg
input Matrix
1.31.3
...3..
.3.21.
.02.1.
..2...
2.23.3
output Matrix
- -
1 .|3|1 .|3|
- - | - |
|. . .|3|. .|
| - - -
|.|3|. 2 1|.
- - - _
. 0 2 .|1 .|
- - - -
|.|.|2 . .|.
| - - -
|2 . 2|3|. 3|
- - - - -
i tried making rules and then call the function to make lines, but couldnt succeed in gettin desired output.
for any queries please comment| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Java - 1of 1 vote
AnswersMultiple threads are running in my program. Exception occurs in one of the thread. There is no exception handling done.
- vijayinani May 23, 2014 in India
What will happen to my program? Will it terminate the complete program? What will happen to other threads?| Report Duplicate | Flag | PURGE
Credit Suisse Software Engineer / Developer Java - 0of 0 votes
Answers`#include<stdio.h>
- ajaybhardwaj789 May 22, 2014 in India
int main(void)
{
int s[4][2] = { {1234,56}, {1212,33}, {1434,80}, {1312,78} };
int (*p)[2];
int i, j, *pint;
for( i=0; i<=3; i++)
{
p = &s[i];
pint = (int*)p; //Q. My Question is why we are required to type cast here. ?
printf("\n");
for( j=0; j<=1; j++)
{
printf("%d",*(pint+j));
}
}
return 0;
}`
Why we are required to perform the typecasting at the comment line ?
What is the exact difference between
1. Pointer to an array int (*ptr)[10]; and
2. Array of pointers int *ptr[10];| Report Duplicate | Flag | PURGE
CSC Software Engineer / Developer C - -1of 1 vote
AnswersWrite code to read from a file and build datastructure that helps you query products based on their category, title, author etc.
- LV May 22, 2014 in United States
ItemNo , Product No (unique), Title, Author, Category
1 , 00000001, Cracking Coding Interview, Gayle Laakmann McDowell , Books > Business, Finance & Law > Careers > Job Hunting
2 , 000002, The Art of Captaincy, Robert James, Books > Biography > Sport > Cricket| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 4of 10 votes
AnswersA man goes to a hardware shop and asks for price of an item. The shop keeper replies that the item is "one for $1".
- careercupuser May 19, 2014 in United States
The man gives the shop keeper "$3 for 600". What did the man buy for his newly painted house?| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Brain Teasers - -1of 9 votes
AnswersFind minimum number of steps to reach the end of array from start (array value shows how much you can move).
- byteattack May 19, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Dynamic Programming - 1of 1 vote
AnswersA 2D matrix with +/- numbers , write a program to return Max sum of submatrix.
- mvk May 19, 2014 in India| Report Duplicate | Flag | PURGE
Flipkart Software Engineer / Developer - 1of 1 vote
AnswersWrite a program to return minimum number of swaps required to convert this binary tree into a BST.
- mvk May 19, 2014 in India| Report Duplicate | Flag | PURGE
Flipkart Software Engineer / Developer Data Structures - 0of 0 votes
AnswersR4 | Q2. Given a BST, find out the minimum length form root to leaf with sum S. Note that:
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
a) Path from root to leaf node.
b) Sum of node of the path is S.
c) if multiple such path exist, print minimum length path.
d) What is advantage of BST rather than BT used for this algorithm, how it improve the performance. in BST, is it required to explore both side ?
e) Write working codes for it.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 4( 2h 30 min)
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
===================
Q1. You are given a Text, where all space, full stop and all punctuation mark is removed. You want to reconstruct the text by putting spaces between words.
A dict is given and following API < bool isInDect(word) > is also given.
a) Decide if the text can be converted a sentence with valid words or NOT.
b) Find how many way you can do the reconstruction of the text
c) Find what is the minimum number of space can be used for this reconstruction.
d) For case (c) find out the indexes where you suppose to put a space.
e) Now recover the text to sentence in place .
Subsequent Question:
1. Why Greedy technique will not work for this
2. yes ! Backtracking will work, what is the problem of using backtracking
3. Illustrate and explain how the solution is contracted from the Dynamic table.
4. Write the correct working code for (c),(d),(e).| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersR3 | Q4. You have a file with million words in it. Find most frequent 10 word in that file. Node that you can store all word in memory.
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
(Note : Min-Heap + List )| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersR3 | Q3. What the different issue in multi-threading ? What is the difference between mutex and semaphore.
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersR3 | Q2. Reverse a 32-bit integers. write code for it.
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 3:(1.h 15min)
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
===================
Q1. In a plane n points (X and Y) is given. How will you find out maximum co-liner points. Extend this algorithms. it for point(x,y,z) in 3D plane.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswerR2 | Q3. Design a Chip-Encryption system. Which will do following operation:
- dutta.dipankar08 May 19, 2014 in India for MS Office Platform
1. Take a word from user
2. Encrypt the word by some Private or public key cryptography or any other algo.
3. Transmit the encrypted word by TCP or UDp or SSL.
Design the class diagram using OOD. Which design pattern you are using to achieve this.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm