Zomato Interview Experience

Test

• 8 MCQs (based on classes, OOPs, output questions, time complexity, DBMS, OS)
• A question which was based on finding the sum of series
1 + (1 + 2) + (1 + 2 + 3) + ……………… + (1 + 2 + 3 + …………… +n)
Time complexity O(1).
• Write a code for a 2-D array such that it there’s a zero, it overwrites all the elements of the corresponding row and column as zero
Input: 1 0 1 1
1 1 1 1
1 1 1 0
1 0 1 0
Output: 0 0 0 0
1 0 1 0
0 0 0 0
1 0 1 0
Without extra space.

Interview
Round #1:

• Write an algorithm for URL compression.
For example:
Input: www.zomato.com/fun/alpha/beta/test
Output: www.zomato.com/tv28t
PS. Multiple answers are acceptable.

• Write a code to find the previous shorter element in an array.
Input:
2
6
7 2 3 4 5 1
6
10 2 8 9 11 2
Output:
-1 -1 2 3 4 -1
-1 -1 2 8 9 -1
• Find minimum cost path (Dynamic Programming)
• Write a code to swap adjacent elements in a linked list (both iteratively and recursively).
Input: 1 2 3 4 5
Output: 2 1 4 3 5
• Write a code to remove two consecutive same numbers from a linked list (both iteratively and recursively).
Input: 1 1 2 2 2 3 4 4 5
Output: 2 3 5



Round #2:

• Design “Ls” command (search function) given a list of files in an array.
Hint: use tries.
Input: [“fun”, “funny”, “foo”, “spam”, “set”]
4
“Ls f”
“Ls fu”
“Ls s”
“Ls r”
Output: fun funny foo
fun funny
spam set
-1
• Write a code to remove adjacent same alphabets from a string such that in resultant string no two characters are same.
Input: “abccbdccc”
Output: adc

Round #3:

• This round was totally resume based. The interviewer asked me to rank my skills in order of the precedencies of mastery. My top two skills were C++ and RubyOnRails. Further questions:
o write various migrations commands.
o Rake commands.
o SQL queries.
o DB design of my project.
• Given a world map such that all the places covered via land are represented by ‘L’ and rest by ‘W’. Since world is spherical hence rows and columns are cyclic (before row 1 row n comes and after row n row 1 same for column). Count the number of islands.
Input:
4
4 4
L W W L
L L W L
L W W W
L W L L
4 4
L W W L
L L W W
L W W W
L W L W
2 2
L L
L L
3 3
W W W
W L W
W W W
Output:
1
2
0
1
• Design “Ctrl + R” function of bash. This command is used to find the previous command typed on bash which is recorded in the memory file.
Function 1: find previous/next command from the current position in memory.
Function 2: find last typed command ‘like’ the given query, if Ctrl + R typed ‘n’ then find the nth previous command from memory.

HR: This was a normal small discussion about interview experience.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


4


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.