Recent Interview Questions
- 0of 0 votes
AnswersSay you have two large files (100 TB each) and only 1 MB of RAM. What's an efficient algorithm that will print the missing lines (diff)? The files don't necessarily contain duplicates.
- CoderDude7 June 17, 2019 in United States
The two files are not sorted and could have different ordering in both files.
e.g.:
File1 File2
A B
B A
C C
D E
F D
F
Output:
File 2: E
The input are two large files (containing strings).
The output is a list of strings telling you the presence of a line in File X and not in File Y.| Report Duplicate | Flag | PURGE
Bloomberg LP Python Developer Algorithm - 0of 0 votes
AnswerQuestion 2: Optimize the problem for total project cost and total project days to minimal.
- ratneshtr09 June 15, 2019 in United States
Given the cost/hour of each worker:
[ 30, 25, 40 ]| Report Duplicate | Flag | PURGE
Intel SDE1 - 0of 0 votes
AnswersQuestion 1:
- ratneshtr09 June 15, 2019 in United States
There is a bunch of tasks, each task has a code with different time to complete and task dependencies. There are few workers, how to allocate the task to these workers to minimize the total time taken to complete the task.
Example:
No of worker: 3
Task id, Task Time, Task dependency:
1, 2, 0
2, 4, 1
3, 7, 0
4, 12, 1
Question 2: Optimize the problem for total project cost and total project days to minimal.
Given the cost/hour of each worker:
[ 30, 25, 40 ]| Report Duplicate | Flag | PURGE
Intel SDE1 C++ - 1of 1 vote
AnswersYou have three Arrays.
- monowar1993 June 14, 2019 in Netherlands for Android
A = {2, 5, 3, 2, 8,1}
B = {7, 9, 5, 2, 4, 10, 10}
C = {6, 7, 5, 5, 3, 7}
make an array from this three arrays which elements is present in at least two array.
This question was followed by instead of three arrays. If you have a list of array then what will be the solution? Also what will be the time complexity?| Report Duplicate | Flag | PURGE
Booking.com Android Engineer Java - 0of 0 votes
AnswersSuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
- ubuntu June 12, 2019 in United States
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
Your algorithm's runtime complexity must be in the order of O(log n).| Report Duplicate | Flag | PURGE
- 0of 0 votes
Answeryou are provided a binary array, and a integer k, choose any k bits of array at a time and flip all the bits, maximize the number of '1's in array.
- aaa June 11, 2019 in United States| Report Duplicate | Flag | PURGE
unknown Student - 0of 0 votes
AnswersP0, P1, ...., Pn players in tournament. In first level, P0 plays with P1, P2 plays with P3 and so on. In level 2, Winner of P0,P1 plays with winner of P2,P3. For i,j output level in which they will face each other assuming they win all games.
- neer.1304 June 11, 2019 in United States| Report Duplicate | Flag | PURGE
Curefit SDE-2 Algorithm - 1of 1 vote
AnswersGiven directory change command -
- neer.1304 June 10, 2019 in United States
cd a/b/../c/d/e/../../
Output the visit count for each directory such as -
Root - 1
a - 2
b - 1
c - 2
d - 2
e - 1| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersGiven a nested list of integers, return the sum of all integers in the list weighted by their depth.
- koustav.adorable June 09, 2019 in United States
Each element is either an integer, or a list -- whose elements may also be integers or other lists.
Different from the question where weight is increasing from root to leaf, now the weight is defined from bottom up. i.e., the leaf level integers have weight 1, and the root level integers have the largest weight.
Example 1:
Input: [[1,1],2,[1,1]]
Output: 8
Explanation: Four 1's at depth 1, one 2 at depth 2.
Example 2:
Input: [1,[4,[6]]]
Output: 17
Explanation: One 1 at depth 3, one 4 at depth 2, and one 6 at depth 1; 13 + 42 + 6*1 = 17.| Report Duplicate | Flag | PURGE
SDE-2 Algorithm - 0of 0 votes
AnswerThere are two thread, Batting thread, and Bowling thread. Batting thread print 1 to 100. Once completed notify to Bowling thread that 'Batting completed.' Java interview questions. If you know please provide complete code.
- routranjanmanas June 08, 2019 in India for 10| Report Duplicate | Flag | PURGE
abc - 0of 0 votes
AnswersGiven range of routing numbers, determine which bank it belongs to.
- neer.1304 June 08, 2019 in United States
Ex-
I/p -(123400,123500, BOA), (12538, 12548, GCU)…
For 123450 - Output BOA
12540 - Output GCU| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - -1of 1 vote
AnswersHi there,
- xyz June 08, 2019 in United States
I'm using a Debian 8 system running Strongswan 5.2 to connect to Cloud VPN, but I'm seeing a large amount of packets being dropped. I'm not sure if the problem is on my side, so I need help debugging from the Google side.
11:44:15.127845 IP (tos 0x8, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.198.99.16: ESP(spi=0x926a1ba9,seq=0x5fc78e8), length 1480
11:44:15.127846 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.199.117.182: ESP(spi=0x2afc306c,seq=0x9753df), length 1480
11:44:15.127848 IP (tos 0x8, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.199.124.50: ESP(spi=0x442d978a,seq=0xaae89d4), length 1480
Any ideas?
n3)Please explain briefly how you identified the correct solution, and if there were any other possibilities that you considered?| Report Duplicate | Flag | PURGE
Google Technical Support Engineer - 0of 0 votes
AnswersHi,
- xyz June 08, 2019 in United States
My virtual machine is talking to our on-premise Hadoop cluster and we have observed connections dropped by the VM after approximately 15 minutes after being established. We have tried tweaking our cluster and the VPN, but it did not work. We have also disabled any firewall or NAT: our cluster is connected directly to the Internet. We ran a TCP packet capture on one of our routers and we do see the following:
408 7.963058 178.124.133.65 172.16.72.34 TCP 66 http > 42867 [FIN, ACK] Seq=312 Ack=11 Win=14592 Len=0 TSval=3673141343 TSecr=234006479
409 7.963204 172.16.72.34 178.124.133.65 TCP 66 42867 > http [FIN, ACK] Seq=11 Ack=313 Win=15744 Len=0 TSval=234006482 TSecr=3673141343
410 7.995556 178.124.133.65 172.16.72.34 TCP 66 http > 42867 [ACK] Seq=313 Ack=12 Win=14592 Len=0 TSval=3673141351 TSecr=234006482
Please help, this is a fault in your network, I need a solution ASAP!
n1) If you were to troubleshoot / debug this issue, what areas would you look into to resolve the issue?
n2) Please explain briefly how you identified the correct solution, and if there were any other possibilities that you considered?| Report Duplicate | Flag | PURGE
Google Technical Support Engineer - 2of 2 votes
AnswersFind whether string S is periodic.
- acoding167 June 07, 2019 in United States
Periodic indicates S = nP.
e.g.
S = "ababab", then n = 3, and P = "ab"
S = "xxxxxx", then n = 1, and P = "x"
S = "aabbaaabba", then n = 2, and P = "aabba"
follow up:
Given string S, find out the P (repetitive pattern) of S.| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
Answerswrite a JSON validator
- boony June 04, 2019 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 3of 3 votes
AnswersGiven two two integer arrays. Find the longest common subsequence.
- acoding167 June 02, 2019 in United States
eg: a =[1 5 2 6 3 7], b = [5 6 7 1 2 3]. return [1 2 3] or [5 6 7]| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersFind the location of BCD in String S.
- bottleneck56 June 01, 2019 in United States
Given for example S = BCXXBXXCXDXBCD, then the result should be [[4,7,9],[11,12,13]
find BCBC in String S = BCXXBXCXBCBC
the result should be [[0,1,4,6],[8,9,10,11]]| Report Duplicate | Flag | PURGE
Google - 0of 0 votes
AnswersGiven multiple tuples in the form of (A,B) where A is the parent and B is the child in a binary tree, find if the input is valid or not. 4 error conditions were provided:
- neer.1304 May 31, 2019 in United States
1. If a parent has more than 2 children,
2. If duplicate tuples entered,
3. If the tree has a cycle,
4. If more than one root possible.
For violation of multiple validity conditions, print the condition coming first in the above order.
If the input is valid, print the tree in a serial representation. For eg: If input is (A,B), (B,C), (A,D), (C,E) , output: (A(B(C(E)))(D))| Report Duplicate | Flag | PURGE
Swiggy SDE-3 Algorithm - 0of 0 votes
AnswersDesign a catalog system – Restaurants, Items, Categories, VariantGroups like Size, Variants like (S,M,L), AddOnGroups like Extra cheese, AddOns like White Cheese, Yellow Cheese. Price of item will vary on variant selected and even addon price will vary on variant selected.
- neer.1304 May 31, 2019 in United States| Report Duplicate | Flag | PURGE
Swiggy SDE-3 Software Design - 0of 0 votes
AnswersDesign Flipkart Flash sale architecture. 2 million hits and 20k orders in 2 sec.
- neer.1304 May 31, 2019 in United States| Report Duplicate | Flag | PURGE
Swiggy SDE-3 Software Design - 0of 0 votes
AnswersGiven character a-z find out nth permutation. Where all permutation are only ascending. For e.g
- neer.1304 May 31, 2019 in United States
Given characters a,b,c. valid permutations are : a,b,c,aa,ab,ac,bb,bc,cc,aaa,aab,aac,abb,acc,baa,bab,bac,bbb,bbc,bcc,caa,cab,cac,cbb,cbc,ccc
Ex- 4th permutation is : aa| Report Duplicate | Flag | PURGE
Swiggy SDE-3 Algorithm - 0of 0 votes
AnswersGiven customer Geo Location(Lat-Long) and List of Restaurants. Each restaurant consist of :
- neer.1304 May 31, 2019 in United States
- Lat long of restaurant
- Name
- List of Items, where each item has
- Item Name
- Prep Time
- Sensitivity ( Low, Medium, High). Lower sensitive items like Icecream cannot be delivered more than 2 KM.
- Find out List of Restaurant Given Customer and Cart is Empty
- Find out SLA(Time to deliver) given cart, restaurant and Cutomer
- Parameters should be Configurable like Sensitivity, Max prep time etc| Report Duplicate | Flag | PURGE
Swiggy SDE-3 design - 0of 0 votes
AnswersUse the location data getting generated from multiple delivery boys moving on the ground to estimate time which a delivery boy will take to move from point A to point B in an area. Additionally, try to do this in real time so that it can be used in assigning delivery boys and minimising delivery time in real time.
- neer.1304 May 31, 2019 in India| Report Duplicate | Flag | PURGE
Swiggy SDE-2 design - 0of 0 votes
AnswersIn a binary tree if the neighbours are set on fire for every node , find the path to optimally set the entire tree on fire.
- neer.1304 May 31, 2019 in India| Report Duplicate | Flag | PURGE
Swiggy SDE-2 Algorithm - 0of 0 votes
AnswersGiven an input stream of Swiggy order timestamps and costs, at any instant find the costliest order in the last X mins
- neer.1304 May 31, 2019 in India| Report Duplicate | Flag | PURGE
Swiggy SDE-2 Algorithm - 1of 1 vote
AnswersYou have a plot with a limited amount of points on it.
Find the cluster of points, which contains the biggest amount of point grouped together.
Conditions:
The cluster means, that points are placed not farther than 5 units (Can be measured px, cm, etc.) between each other. The distance is calculated by where|x1-x| < 5
and
|y1-y| < 5
The cluster should contain at least 3 points.
- denis.zayats May 30, 2019 in United States
If there are a few clusters with the same amount of points - return all of them.
Example:
The points are:
(15,116), (1345, 123), (456, 11), (34, 17), (19, 112), (556, 111), (454, 15), (12, 120).
In this case, the best cluster is (15,116), (19, 112), (12, 120)| Report Duplicate | Flag | PURGE
Google SDE-3 Algorithm - 1of 1 vote
Answers"Good Range"
- Mit25 May 29, 2019 in United States
There is a number space given from 1 to N. And there are M queries followed by that. In each query, we were given a number between 1 to N (both inclusive). We add these number one by one into a set.
Good range: A range in which there is exactly one element present from the set.
For each query, we need to find the good ranges. We need to return the sum of boundry of all good ranges.
Input:
First line will take two integer for input N and M.
Then following M lines would be numbers between 1 and N (both inclusive).
Output:
Following M lines contains sum of boudaries of good ranges.
Note:
Range can consist of single element and represented as (x-x) where boundary sum will be x+x.
Example:
Input:
10 4
2
5
7
9
Output:
11
18
30
46
Explaination:
step-1) set: 2
good range: (1-10)
sum: 1+10=11
step-2) set: 2 5
good range: (1-4), (3-10)
sum: 1+4+3+10=18
step-3) set: 2 5 7
good range: (1-4), (3-6), (6-10)
sum: 1+4+3+6+6+10=30
step-4) set: 2 5 7 9
good range: (1-4), (3-6), (6-8), (8-10)
sum: 1+4+3+6+6+8+8+10=46| Report Duplicate | Flag | PURGE
Amazon SDE1 Coding - 0of 0 votes
AnswerYou are given an N-Dimensional list with 2 methods:
- neer.1304 May 27, 2019 in United States
i) getDim -> returns the dimensions .e.g [5,4,3].
ii) getElement([i,j,k]) -> return list[i][j][k] . You have to implement a method to sum all elements in the list.| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Algorithm - 0of 0 votes
AnswerDesign a system to upload images with tags. The tags should be searchable and search should return images linked to those tags.
- arnold086 May 25, 2019 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design
Open Chat in New Window