Software Developer Interview Questions
- 0of 0 votes
Answersadd 2 huge numbers represented by linked list. Each linked list element represents a 4 digit number:
- capricornkmu October 17, 2015 in United States for OpenStack
linked list1 : 8798 -> 8765 -> 1243 -> 9856 -> 8888 -> 0914
linked list 2: 8710 -> 5634 -> 1276 -> 8123 -> 1354 -> 9876
output: ................-> ............. ..-> 7980->0243 -> 0790| Report Duplicate | Flag | PURGE
Ebay Software Developer C - 0of 0 votes
Answersdifference between shared tree and source specific tree in multicast
- capricornkmu October 17, 2015 in United States for OpenStack| Report Duplicate | Flag | PURGE
Ebay Software Developer Network - 0of 0 votes
Answerswrite a program to validate a IPV4 address
- capricornkmu October 17, 2015 in United States for OpenStack| Report Duplicate | Flag | PURGE
Ebay Software Developer C - 0of 0 votes
AnswersGiven an array of positive, unique, increasingly sorted numbers A, e.g. A = [1, 2, 3, 5, 6, 8, 9, 11, 12, 13]. Given a positive value K, e.g. K = 3. Output all pairs in A that differ exactly by K.
- simplysou October 06, 2015 in United States
e.g. 2, 5
3, 6
5, 8
6, 9
8, 11
9, 12
what is the runtime for your code?| Report Duplicate | Flag | PURGE
Facebook Software Developer - 3of 3 votes
AnswersDesign Live comments. If your facebook.com homepage is open with bunch of feeds and if someone comments on those feeds, the comments should automatically show up in facebook.com home page without refreshing the page. Feeds could be a simple status update by a friend, post in a group, post by a person you're following, post in a page you've liked etc.
- Rejected September 29, 2015 in United States
Few things what they are looking for -
1. How do you solve it initially and how do you scale it?
2. How do you scale push model in-case if you choose PUSH model to solve it?
3. If push cannot scale how do you solve it?
4. How pull model solves it?
5. When will you use push vs pull?| Report Duplicate | Flag | PURGE
Facebook Software Developer Software Design - 1of 1 vote
AnswersHadoop architecture:
- Maniac87 September 20, 2015 in United States
How would you deisgn a Craiglist based architecture ?
What hadoop components you would use. Given the user can search for a car and the car listings get updated frequently. How would you design the craglist system. What database you would use and how would you process the data ?| Report Duplicate | Flag | PURGE
Software Developer System Design - 1of 1 vote
Answers3. Implement a function that returns the i-th most popular item sold at Amazon. You cannot rely on any libraries.
- laurentr September 18, 2015 in United States
class Item {
String itemId;
int quantitySold;
}
/**
* Find the ith most popular item in the list.
*/
String find(List<Item> items, int i) {
// your code goes here
}| Report Duplicate | Flag | PURGE
Amazon Software Developer - 1of 1 vote
Answers2. Suppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. You are only allowed to move up, down, right or left. Diagonal movement is not allowed.
- laurentr September 18, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end: 0,3
Output
true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output
false
Example #3
Input
0 0 1 1 1
0 1 0 0 0
0 1 1 1 1
start: 0,0
end: 2,1
Output
False
class Position {
final int x, y;
public Position(final int x, final int y) {
this.x = x;
this.y = y;
}
}
boolean pathExists(int[][] puzzle, Position start, Position end) {
// your code goes here
}| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
Answers1. Write a function that removes the duplicate of a collection of numbers and returns the number of elements remaining in the collection after the duplicates have been removed. You must ensure that duplicates are actually removed from the list.
- laurentr September 18, 2015 in United States
Example #1
Input
{1, 1, 5, 3, 8, 3, 7, 32, 32}
Output
6
Example #2
Input
{21, 10, 24, 2, 21}
Output
4
int removeDuplicates(List numbers) {
// your code goes here
}| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswersProblem:
- Yev September 16, 2015 in United States for Anti-money laundering
8 balls, where 7 have equal weight, one does not. Find minimum times to use a scale to find ball that is not equal weight.
Interviewer answer: weight 6 balls. Choose balls from lighter side. Total two attempts. This is the average case but not the best case.
This is not true in all cases and the interviewer did not see this...
Best case:
Pick two balls. One may weight less, so the lighter ball is found with one attempt. This is the best case.
Worst case: If first two balls are equal, weight 6 balls. Choose balls from lighter side. Weight again. Total three attempts.| Report Duplicate | Flag | PURGE
BMO Harris Bank Software Developer Algorithm - 11of 11 votes
AnswersGiven a string which only contains lowercase. You need delete the repeated letters only leave one, and try to make the lexicographical order of new string is smallest.
- lxfuhuo September 09, 2015 in -
i.e:
bcabc
You need delete 1 'b' and 1 'c', so you delete the first 'b' and first 'c', the new string will be abc which is smallest.
ps: If you try to use greedy algorithm to solve this problem, you must sure that you could pass this case:
cbacdcbc. answer is acdb not adcb
I can't solve this problem well and the interviewer said that you can scan the string twice. First scan is do some preprocess, and the second is to get the answer, but I really can't come up this idea.| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 8of 8 votes
AnswersYou are given a list of n float numbers x_1, x_2, x_3, ... x_n, where x_i > 0.
- emb September 04, 2015 in United States
A traveler starts at point (0, 0) and moves x_1 metres to the north, then x_2 metres to the west, x_3 to the south, x_4 to the east and so on (after each move his direction changes counter-clockwise)
Write an single-pass algorithm that uses O(1) memory to determine, if the travelers path crosses itself, or not (i.e. if it's self-intersecting)
e.g.
2 1 1 2 -> crosses
1 2 3 4 -> doesn't cross| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 2 votes
AnswersYou have given an array and you want to find an integer k so that the sum of the distances from k to each of the n integers is minimized. Define distance between two integers a and b as |a−b|3.
- pbox August 26, 2015 in India| Report Duplicate | Flag | PURGE
Cisco Systems Software Developer - 2of 2 votes
AnswersA multiset or a bag is a collection of elements that can be repeated. Contrast with a set, where elements cannot be repeated.
- ersegun August 20, 2015 in Netherlands
Multisets can be intersected just like sets can be intersected.
Input :
A = [0,1,1,2,2,5]
B = [0,1,2,2,2,6]
Output :
A ∩ B = C = [0,1,2,2]
Input :
A = [0,1,1]
B = [0,1,2,3,4,5,6]
Output
A ∩ B = C = [0,1]
Write a function to find the intersection of two integer arrays in that way ?| Report Duplicate | Flag | PURGE
Booking.com Software Developer String Manipulation - 2of 2 votes
Answers"Smart substring"
- ersegun August 20, 2015 in Netherlands
Write a function that takes maximum 30 characters from a string but without cutting the words.
Full description:
"Featuring stylish rooms and moorings for recreation boats, Room Mate Aitana is a designer hotel built in 2013 on an island in the IJ River in Amsterdam."
First 30 characters:
"Featuring stylish rooms and mo"
Smarter approach (max 30 characters, no words are broken):
"Featuring stylish rooms and"| Report Duplicate | Flag | PURGE
Booking.com Software Developer String Manipulation - 0of 0 votes
AnswersFind the nth Fibonacci Prime, in the shortest code
- kesavan August 19, 2015 in India| Report Duplicate | Flag | PURGE
unknown Software Developer - -1of 1 vote
AnswersBillions of 2 digit number is coming from stream and you have a variable avg. which store only 2 digit number that means you cant store 2 number in any temp variable also.calculate avg on incoming stream
- pbox August 19, 2015 in India| Report Duplicate | Flag | PURGE
Flipkart Software Developer - 2of 4 votes
AnswersA string contains a-z, A-Z and spaces. Sort the string so that all lower cases are at the beginning, spaces in the middle and upper cases at the end. Original order among lower and upper cases needs to remain the same. For example: a cBd LkmY becomes ackm BLY. Is there a way in O(n) without extra space?
- chad August 13, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm Arrays - 5of 5 votes
AnswersI came across this problem online.
- xiaoc10 August 07, 2015 in United States
> Given an integer:N and an array int arr[], you have to add some
> elements to the array so that you can generate from 1 to N by using
> (add) the elements in the array.
Please keep in mind that you can only use each element in the array once when generating a certain x (1<=x<=N). Return the count of the least adding numbers.
For example:
N=6, arr = [1, 3]
1 is already in arr.
add 2 to the arr.
3 is already in arr
4 = 1 + 3
5 = 2 + 3
6 = 1 + 2 + 3
So we return 1 since we only need to add one element which is 2.
Can anyone give some hints?| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 4of 4 votes
AnswersCheck if two integers are equal without using any comparison operators.
- coolProgrammer August 03, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Developer Bit Manipulation - 2of 2 votes
AnswersFind how many numbers of length n are there such that each number is at least 4 smaller/greater than the number before and after it.
- coolProgrammer August 02, 2015 in United States
Eg: if n = 5, such numbers are 39518, 15951, etc.| Report Duplicate | Flag | PURGE
Google Software Developer Dynamic Programming - 1of 1 vote
AnswersThere are three closed doors. Behind two of them there are donkeys, behind the third one there is a Mercedes-Benz. (Your task is to get the Mercedes, not the donkey).
- leonid.ge July 31, 2015 in United States
You are asked to choose one of the doors. Once you have chosen, they open one of the remaining two doors with the donkey. Now there are two doors left: one you chose and the other one. To maximize your chance of getting the Mercedes, should you keep your choice or switch to the other door?| Report Duplicate | Flag | PURGE
xyz Software Developer Brain Teasers - 0of 0 votes
Answerswrite a program how many squares in chessboard ?
- ajju July 26, 2015 in India| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersImplement hashtable put function in C++ without using STL stuff.
- kustiki July 21, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Developer - 3of 3 votes
AnswersGiven a matrix containing 0 and 1. Consider 1 as 'Land' and 0 as 'Water'. Find out the number of 'Islands' in the matrix. That is, set of all adjacent 1 will make up for an island.
- prajakta mahamuni July 17, 2015 in India
For example:
[ 0 1 1 0 1 ]
[ 1 1 1 0 0 ]
[ 0 0 0 1 1 ]
[ 1 0 0 1 0 ]
This problem has 4 islands. ( consider set of 1s, vertically, horizontally and diagonally ).| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswersPlease provide Oracle SQL and PLSQL questions
- subhasinibhosal1004 July 17, 2015 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Developer SQL - 0of 0 votes
AnswersSuppose you have strings read in from a stream, e.g., '()(,)(())'. Detect if the parenthesis pair up correctly.
- Yev July 16, 2015 in United States
Part 1: How would you use threads to solve the problem?
Part 2: He then gave me an iterative solution and asked how the problem can be done distributively across multiple components.| Report Duplicate | Flag | PURGE
Here Software Developer Algorithm - 1of 1 vote
AnswersGiven a hashmap, HashMap<String,List<String>> with the following data:
- Yev July 16, 2015 in United States
A: B,C
B: X Y
X: Z
Y: Z
Expected output is an array of the dependencies. I initially started with Breadh-first search for simplicy, which had running O(|V|+'E') and space O(|V|). The interviewer said depth-first search is better; I don't see how DFS is better, because it requires recursion.
Part2: He then said my solution is functionally correct and then introduced a circular dependency and asked how to resolve it. I said using a visited hashset will detect a circular dep. He said it's not quite right and there a few approaches.| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 0 votes
AnswersGiven a string of english characters. Find the character that appears only once. I used arr[256] to store a count of each character. Then, iterate over the array to find the first non-dup, a[iter+'a']==1. The interviewer thought that storing a[iter]='x' (dup) and a[iter]=<index> was a better solution to avoid running a second pass over the string. In my mind, I disagreed using the array index, one can find the character that appears only once. The interviewer persisted, and told me to think about it.
- Yev July 16, 2015 in United States| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 2 votes
AnswersWrite a function which takes a BST and then "flattens" it (converts in-place into new BST), so all the nodes have only right child and no left.
Example:10 / \ 5 15
Output:
- Eugene July 16, 2015 in United States5 \ 10 \ 15
| Report Duplicate | Flag | PURGE
Microsoft Software Developer
Open Chat in New Window