Software Engineer / Developer Interview Questions
- 1of 1 vote
AnswerGame of Death:
- praneeth.kapuganti July 07, 2017 in United States
Implement an algorithm that produces the next move in the game of death.
Basically given a two dimensional array it will have either values 1 (live cell) or 0 (dead cell)
1. A Live cell will live only if it has two or three live neighbors All other cases die.
2. A dead cell with exactly three live neighbors will live otherwise no change, dead
Transform the array by using above two rules| Report Duplicate | Flag | PURGE
Dropbox Software Engineer / Developer Algorithm - 0of 0 votes
AnswerMake 100 HTTP GET requests to http://en.wikipedia.org/wiki/Main_Page and print the following statistics for the response time to stdout:
- Pedro June 24, 2017 in United States
• 10th, 50th, 90th, 95th, 99th Percentile
• Mean
• Standard Deviation
Your solution must be parallel. You must make at least N (say 10, but should be configurable). Use ExecutorService in Java for making the requests at a time.
Explain design choices, known limitations and edge cases.
What challenges did you face? How would you improve the code if you had more time?| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 1of 1 vote
AnswersDesign an algorithm that provided your current location and a list of ATMs locations in the area, get you the closest K ATMs to your location.
- ahmedthehack June 23, 2017 in UK for Amazon Video
Assume you have a method getDistance(a, b) that calculates the distance between a and b.
Follow Up:
Make your solution O(k) space and O(n) time| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersDesign an algorithm to find the shortest substring in a synopsis such that it contains all the words in a provided list.
- ahmedthehack June 23, 2017 in UK for Amazon Video
So, search for the shortest substring that contains ['Hello', 'World'].| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersDesign a system for a parking lot where drivers can also have memberships (but also support guest drivers). The parking lot has counter screens on each row.
- ahmedthehack June 23, 2017 in UK for Amazon Video| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 0of 0 votes
AnswersDesign a message board system like Reddit were users can reply with messages on posted topics. How will you handle system scalability.
- ahmedthehack June 23, 2017 in UK for Amazon Video| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 0of 0 votes
AnswersRegex matching algorithms
- sonesh May 08, 2017 in United States
You will be given a string and a pattern string consisting of only '*','?', and small letters. You have to return tree or false based upon the comparisons.
? repersent one char.
* means zero or n number of char for any positive n.
Example
abc, a?c : true
abc, a*?c : true
abc, * : true
abc, ?c : false| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer String Manipulation - 0of 0 votes
AnswersYou are given following design architecture.
[DB] <==> [Server]
Now let's say user are complaining about our server being slow, how would you figure out where is the problem?
- sonesh May 08, 2017 in United States
2) now let's say the problem is in server, where do you think the problem is in server?
3) What if you found our server is fast, how about now?
4) you have also found that the network call from server to DB is also fast, how about now?
5) Lets say, our server is also setting near the complaining user, how about now?| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer design - 0of 0 votes
AnswersYou are given two Queues where each queue contains timestamp price pair. You have to print <price1 price 2> pair for all those timestamps where abs(ts1-ts2) <= 1 second where ts1 and price1 are the from the first queue and ts2 and price2 are from the second queue.
- sonesh May 08, 2017 in United States
Now let's say one queue is slow, what kind of modification you will make?| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Stacks q - 0of 0 votes
AnswersYou are given an array of nodes where each node consists of node name, isValid flag, and parent Node index. so, this array actually represents a tree(forest). where root node has -1 as its index for the parent node. rest all node have their parent's index value.
- sonesh May 08, 2017 in United States
You will be given this array and an index. You have to cut down the subtree from the index. Cutting down a tree means, making all the nodes of that subtree false(Isvalid flag).
He was expecting O(N) solution.| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Arrays Coding Trees and Graphs - 0of 0 votes
AnswersDefine Reverse Polish notation calculator. Interviewer needed class design for the calculator. Please make sure that adding extra operator tomorrow should not make us change the class or any of its methods.
- sonesh May 08, 2017 in United States| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer design - 0of 0 votes
AnswersYou are given an array of stock prices, You have to return maximum profit one can make when buying once and selling once. Consider, you are buying one stock only.
- sonesh May 08, 2017 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou are given set of strings, you have to print out the could of each distinct patterns. Please consider anagrams as same pattern and even the char count does not matter.
- sonesh May 08, 2017 in United States
Ex:
abbba
ab
ba
abcd
abdc
adbc
aabddc
output:
ab: 3
abcd: 4| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou are given three type of data sets.
- sonesh May 08, 2017 in United States
Type 1
Data size: 4 billion
Distinct Data: 1000
Type 2
Data Size: 4 billion
Distinct Data: 2 billion
Type 3
Data Size: 1000
Each Data is of length 100 million byte
What kind of data structure would you use to answer search/insert/remove queries for each data types?| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Data Structures - 0of 0 votes
AnswersQ 4. You are given a binary tree, and you have to return list of lists of node. where same level nodes should be in the same list, nodes are in opositive order in next list from the previous list
Ex:4 / \ 3 5 / \ \ 1 10 -4
Output would be
- sonesh April 28, 2017 in United States
[[4], [5, 3], [1, 10, -4]]
Desigred Complexity : O(N) + O(N).| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Linked Lists Stacks Trees and Graphs - 0of 0 votes
AnswersQ 3. You are given a LinkedList and a number K. You have to reverse it in the groups of K
- sonesh April 28, 2017 in United States
Ex :
[1] -> [2] -> [3] -> [4] -> [5] -> null, K = 3
output: [3] -> [2] -> [1] -> [5] -> [4] -> null
Desired Complexity: O(n) + O(1)| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersQ 2. You are given a chess game board of size NxN. You have find out positions(i,j), where you can place N queens so that, none of the queens can kill each other without making their first move.
- sonesh April 28, 2017 in United States| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Algorithm Coding Dynamic Programming Matrix - 1of 1 vote
AnswersQ 1. You are given an array of integers, contains positive, negative and zeros. You have to written subarray whose sum is maximum in this array.
- sonesh April 28, 2017 in United States
Desired Complexity is O(N) + O(1)| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Algorithm Arrays - 0of 0 votes
AnswerQ 7. You are getting a stream of integers, You have to find the median of these in real time(or with minimum complexity).
- sonesh April 26, 2017 in United States| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Algorithm - 0of 0 votes
AnswersTheoretical Questions
- sonesh April 26, 2017 in United States
Q 1. Any design patterns you have used, please explain in details
Q 2. Difference between a process and a thread
Q 3. How threads/processes can communicate with each other.
Q 4. What is latency and throughput, what is there the difference?
Q 5. When to use merge sort over quick sort and vice-versa.
Q 6. What is hashmap, how would to implement one.| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Brain Storming technical - 4of 4 votes
AnswersGiven arrays for N (>= 2) users, each representing the IDs of hotels visited, find the common IDs of the hotels visited amongst the users.
- PraTrick April 26, 2017 in India
Input:
userA = { 2, 3, 1 }
userB = { 2, 5, 3 }
userC = { 7, 3, 1 }
Output:
{3}
Assumptions:
Arrays are unsorted.
Cases:
1) Each array consists of distinct hotel IDs
2) Each array may contain duplicate hotel IDs| Report Duplicate | Flag | PURGE
Booking.com Software Engineer / Developer - -1of 1 vote
AnswersYou are given an array of integers and a number K. You have to find the any continue sub-array whose elements sum is K. Please note that, the array may have positive, negative, and zeros as its element.
- sonesh April 22, 2017 in United States
The desired complexity is O(N).
Example:
Input: [7 0 9 -10 0 789], K = 0
Output: Array from index 1 to Index 1.
Input: [1 2 3 5 -10] K = 0
Output: Array from Index 1 to Index 4.
If K = -2, Output would have been SubArray from Index 2 to Index 4.| Report Duplicate | Flag | PURGE
Snap Inc Software Engineer / Developer Arrays - 0of 0 votes
AnswersYou are given an integer array. You have to return/print an array where kth element of this array is the multiplications of all the elements from 0 to k-1 and from k+1 to n-1.
- sonesh April 20, 2017 in United States
Example
input: [1 2 5 6]
output: [60 30 12 10]| Report Duplicate | Flag | PURGE
Coupang Software Engineer / Developer Arrays - 0of 0 votes
AnswersYou are given a BST of integers and an integer K. You have to find the smallest greater integer then K in the BST.
Ex
- sonesh April 20, 2017 in United States40 --- 50 --- 80 | | | 45 20 --- 30 | | 10 K = 35 Output: 40
| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Trees and Graphs - 1of 1 vote
AnswersWe define a k-subsequence of an array as follows
- sonesh April 18, 2017 in United States
1) it is a subsequence of consecutive elements in the array
2) the sum of the subsequence's elements s, is evenly devisible by k(i.e. s % k == 0)
Given an integer and input array, find out the number of k-subsequences.
Example: k=3 and array be [1 2 3 4 1]
Output: 4 ({1 2},{1,2,3},{2,3,4},{3})| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou are given an array with duplicates. You have to sort the array with decreasing frequency of elements. If two elements have the same frequency, sort them by their actual value in increasing order.
- sonesh April 18, 2017 in United States
Ex: [2 3 5 3 7 9 5 3 7]
Output: [3 3 3 5 5 7 7 2 9]| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Sorting - 0of 0 votes
AnswersYou are given two string (like two statements). You have to remove all the words of second string from first string and print the remaining first string. Please maintain the order of the remaining words from the first string. You will be only removing the first word, not all occurrence of a word.
- sonesh April 18, 2017 in United States
Example: Str1 = "A Statement is a Statement", Str2 = "Statement a"
Output: "A is Statement"| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer String Manipulation - 0of 0 votes
AnswersYou are given an integer, print its 4th least significant bit
- sonesh April 18, 2017 in United States| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Bit Manipulation - 0of 0 votes
AnswersYou are given a rotated sorted array of size N. You have to search a given number into it.
- sonesh April 18, 2017 in United States
Example: [4,6,8,14,90,-9,-2,0,3], Search -2.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays Sorting - 0of 0 votes
AnswersYou are given an array of words. from each word, you make a chain, in that, you remove one char at a time and you remove that char only when the remaining word is present in the input array.
- sonesh April 18, 2017 in United States
For Example, if the input is {a, b, ab, ac, aba}
then the possible chains are
from 'a', there is no chain, the chain it 'a' itself (of length 1)
similarly, from 'b', the chain length is 1 one (length is defined by the number of words in the chain)
now from 'ab', there are two possibilities which are ({ab -> b when you remove a},{ab -> a when you remove b}). So the max length is 2 here
now from 'ac', we only have one possibility which is ({ac -> a when we remove c}), because, when we remove 'a', we left with 'c' which is not present in the input.
Now, you have to find the length of the biggest such chain.
Input: array of words
Output: length of the biggest such chain.| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Algorithm String Manipulation