Recent Interview Questions
- 0of 0 votes
AnswerCount Triplets such that one of the numbers can be written as sum of the other two
- Nits January 30, 2020 in India| Report Duplicate | Flag | PURGE
Grab Software Development Manager - -2of 2 votes
AnswersFor Fun
- rihanakhan07 January 20, 2020 in India for Fun Team| Report Duplicate | Flag | PURGE
Digital Merkating Analyst - -1of 1 vote
AnswersAgree
- rihanakhan07 January 20, 2020 in India for Fun Team| Report Duplicate | Flag | PURGE
Digital Merkating Analyst - 0of 0 votes
AnswersThe question is basically on trees
- Noob January 19, 2020 in United States
1
2 3
4 5 6 7
You can lock any node, Once the node is locked all the ancestors and descendents of that node are also locked. You cannot acquire a lock on a node which is already locked.
You can unlock the node on which you have acquired a lock.
Implement it using multithreading.| Report Duplicate | Flag | PURGE
AMD Algorithm - 0of 0 votes
AnswersRakesh and mahesh are brothers born in may
- Stubborn January 18, 2020 in India
But they celebrate their birthday in june
Why so??
Hint: Name does'nt matter u can take any other names| Report Duplicate | Flag | PURGE
- 5of 5 votes
AnswersGiven K sorted (ascending) arrays with N elements in each array, implement an iterator for iterating over the elements of the arrays in ascending order.
The constructor receives all of the input as array of arrays.
You need to implement the MyIterator class with a constructor and the following methods:class MyIterator<T> { T next(); boolean hasNext(); }
You are allowed to use only O(K) extra space with this class.
example:
input:[[1,5,7], [2,3,10],[4,6,9]]
The iterator should return:
- torchs January 13, 2020 in Israel1,2,3,4,5,6,7,9,10
| Report Duplicate | Flag | PURGE
Facebook Solutions Engineer Algorithm - -1of 1 vote
AnswersGiven an array of sets find the one that does not belong:
- billybill January 03, 2020 in United States
example: [[a,b,c,d], [a,b,f,g], [a,b,h,i], [j,k,l,m]]
output: [j,k,l,m]
We can see above that the first three sets have a subset [a,b,c] and the last one does not. Note: There may be a case where the outlier set does have elements contained in the input group. In this case we have the find the set that has the least in common with the other sets.| Report Duplicate | Flag | PURGE
Google Software Engineer Sets - 0of 0 votes
AnswerProblem:
- giridharikhandelwal1 January 03, 2020 in India
1. Given a Mix of all types of characters which includes Special characters, Numbers, String in a Log file.
for eg: "HappyI%&&87Christmas %%$^%&NewYear"
2. Get the largest substring which
"contains the Characters in Even Position followed by a Special Character and
then a meaningful word should be coming up"| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Problem Solving - 0of 0 votes
AnswersQ. find the number of ways a string can be formed from a matrix of characters.
- tusharrawat831 December 29, 2019 in United States
It can start forming a word from any position in mat[i][j] and can go in any unvisited direction from the 8 directions available across every cell [i][j].
sample case :
input:
N = 3 (length of string)
string = fit
matrix :
fitptoke
orliguek
ifefunef
tforitis
output: 5
explanation:
num of ways to make 'fit' from matrix chars are 5 as given below sequence:
(0,0) (0,1)(0,2)
(2,1) (2,0)(3,0)
(2,3) (1,3)(0,4)
(3,1) (2,0)(3,0)
(2,3) (3,4)(3,5)
How can we solve it efficiently without doing DFS across every position [i][j], which makes time complexity exponential?
Is there a better way possible in terms of time complexity? Maybe caching of values or something!| Report Duplicate | Flag | PURGE
Software Engineer Algorithm - 1of 1 vote
AnswersThere is a 2D matrix of 0s and 1s that depicts the number of rooms that can be formed by a co-working space company like WeWork based on the values. 1 means open space for room and 0 means wall. We need to group as many 1s and possible to form the largest and minimum number of rooms.
- Jigisha Aryya December 25, 2019 in India
E.g.
Number of Rows = 5, Number of Columns = 5
00010
01110
01100
01101
00011
Output: 4
Input 2:
4
3
001
111
011
100
Output: 4| Report Duplicate | Flag | PURGE
unknown Backend Developer Algorithm - 1of 1 vote
AnswersA startup website has a lot of real-time traffic . I want to see the real-time view (refreshed every 1 min) of top 20 users by hit count within last 10 mins. Full distributed system, I have to resolve all the concurrency issues.
- acharyashailendra1 December 22, 2019 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 1 vote
AnswersWhat to do when we are poor on coding
- shekharlevadi100 December 21, 2019 in India| Report Duplicate | Flag | PURGE
Accenture Software Engineer Coding - 1of 1 vote
AnswersClass A has two data members which are instances of class B and class C. Class B needs an instance of class C to be created. We have to create an instance of object A on stack like 'A objA' in main function. 'new' operator should not be used anywhere.no objects on the heap
- vijay8836 December 18, 2019 in United States| Report Duplicate | Flag | PURGE
Adobe Software Engineer C++ - 2of 2 votes
AnswersHere is a question from the "Cracking The Coding Interview" book with a twist.
- fz December 17, 2019 in United States
Implement a method to perform basic string compression using the counts of repeated characters. (p. 73 5th edition)
The twist: the string can also contain digits. Think of encoding and decode protocol. How the compression can be reversed properly?
For example, ab2ccccd -> ab24cd| Report Duplicate | Flag | PURGE
Amazon Algorithm - 1of 1 vote
AnswerPlease have a look at the following pseudo-code. Please note that the syntax may be completely different from any of programming languages you know. More specifically, indentation does not matter in this code, ":=" denotes the substitution, "=" is the equal comparator, and the condition in FOR statement is boundary-inclusive.
- chiranjibparida123 December 17, 2019 in United States
========
Initial state of an array "a":
[[4, 2, 4, 2],
[4, NULL, 4, 2],
[2, NULL, 8, 2],
[16, NULL, 4, NULL]]
========
Main function:
FUNCTION foo()
FOR y := 0 to 3
FOR x := 0 to 3
IF a[x+1][y] != NULL
IF a[x+1][y] = a[x][y]
a[x][y] := a[x][y]*2
a[x+1][y] := NULL
END IF
IF a[x][y] = NULL
a[x][y] := a[x+1][y]
a[x+1][y] := NULL
END IF
END IF
END FOR
END FOR
END FUNCTION
What is the issue with the above code?
How would you fix it?| Report Duplicate | Flag | PURGE
- 1of 1 vote
AnswersGiven a matrix, find all its combinations by row. For example,
- fz December 11, 2019 in United States
[a, b, c]
[d, e, f]
[x, y, z]
its combinations are adx, ady, adz, bdx, …. cfy, cfz| Report Duplicate | Flag | PURGE
Algorithm - 1of 1 vote
AnswersRearrange a LinkedList:
- fz December 11, 2019 in United States
Before : a->x->b->y->c->z
After : a->b->c->z->y->x| Report Duplicate | Flag | PURGE
Algorithm - 2of 2 votes
AnswersA list of relation is given. We need to express the relation in a single line with the largest unit leftmost.
- accessdenied December 09, 2019 in United States
eg.
a = 10b
b=5c
c = 20a
e=20d
a=10b=25e=50c=500d| Report Duplicate | Flag | PURGE
Algorithm - 1of 1 vote
AnswerViews are not lifecycle aware that's true but what more? In modern development there is hardly any difference.
- kaustubh deshmukh December 01, 2019 in India| Report Duplicate | Flag | PURGE
Facebook Android Engineer Android - 2of 2 votes
AnswersGiven a list of 2d points, if any two points have distance(straight line) <= k , group them together. For example. [P1,P2,P3], P1 to P2 <=k, P2 to p3<=k, p1 to p3>k. they are still in the same group. (distance relationship is chainable ) ask how many groups can you find ? I can think of N^2 time complexity with union and find. but how to do better than that? maybe NlogN or O(N)?
- laoen November 30, 2019 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersFind the first N words with the highest frequency in an array of strings. The result needs to be sorted by frequency.
- fz November 26, 2019 in United States
For example:
An array of String:
Inputs:
{"geeks", "for", "geeks", "a", "portal", "to", "learn", "can", "be", "computer", "science", "zoom", "yup", "fire", "in", "be", "data", "geeks"}
and the first 2 words with the highest frequency.
Outputs: {'geek", "be"}
where "geek" has a frequency of 3 and "be" has a frequency of 2.| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersGiven someone's favorite songs (as a map) and a genre category (as a map as well). Find out this person's most favorite genre. For example,
- fz November 25, 2019 in United States
"David": ["song1", "song2", "song3", "song4", "song8"],
"Emma": ["song5", "song6", "song7"]
and
"Rock": ["song1", "song3"],
"Dubstep": ["song7"],
"Techno": ["song2", "song4"],
"Pop": ["song5", "song6"],
"Jazz": ["song8", "song9"]
Output:
"David": "Rock"
"Emma": "Pop"| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersGiven a list of a string which is a list of words separated by a space. Sort the list in the lexicographical order. For example, given the followings:
- fz November 25, 2019 in United States
[act car]
[air dog]
[act zoo]
Result:
[act car]
[act zoo]
[air dog]| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersWrite a binary calculator for summing two strings. Could not use standard {{ bin }} method.
- ito ogami November 20, 2019 in United States| Report Duplicate | Flag | PURGE
Pinterest Software Developer Programming Skills - -1of 1 vote
Answersreverse an array for k distance.
- 786.senthil November 15, 2019 in United States
[2,3,1,5,4] and k =3
output : [2,3,1,5,4]
method
void reverse(int[] arr, k)
this method will only reverse the array
write another method which will sort the array by incorporating reverse method inside sort.
You must have to call reverse(arr,k) method to sort the array. You are not allowed to modify the reverse method| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswersTwo sum problem
- xyz November 14, 2019 in United States for Load Balancer| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersPrepare test plan for a new feature of " deposit cheque via mobile app " which is added under menu tab.
- raghunath.e November 14, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test test
Open Chat in New Window