Q1. Given a linked list with each node’s data being either a character or whitespace. Reverse the words of the linked list.
Input: T->h->i->s-> ->i->s-> ->a-> ->h->o->u->s->e
Output: s->i->h->T-> ->s->i-> ->a-> ->e->s->u->o->h
Q2. Given an array, find triplets such that : Uniq (a, b, c) -> (val = val[a]+val[b]) where a, b, c are indexes of the array.
Input array: [2, 2, 4, 6, 6, 8, 10, 12]
Output should be: (0, 3, 5) (1, 3, 5) (0, 4, 5) (0, 2, 3) (1, 2, 3) (1, 4, 5) …..and others
Q1. Find median in 2 sorted arrays.
Q2. Find if 2 trees are mirror images of each other?
Q3. Given an AP, find the missing number.
Q1. Design multi-level parking system with multiple entries and exits. Basic discussions first, then more questions like:
-Minimize the operations – findEmptySlot, ParkAVehicle, EmptyASlot, etc.
-How would you handle the situations where there is one slot empty and multiple cars from different entries.
-How will you make sure that your system returns the first nearest available slot.
For example, findEmptySlot() should not return level 2 if Level 1 slot is empty. If level 1 is not empty, then only return Level 2.
(Please provide/discuss solutions, if you have, to this in the comments section below)
Q2. How is locking done in databases?
Q3. Given a binary tree, print its each diagonal sum.
Q4. How is hashmap internally implemented? Discussion on Java 7 vs Java 8 implementations.
Q5. Mutex vs semaphores.
Q5. Few other questions related to databases – Don’t remember them!
Q1. Design a fb post endpoint. Each post has multiple comments. Each comment can have multiple replies. Like A made a comment, B made another comment on the post.
Replies have some order/hierarchy: example – X might reply on A’s comment, Y on both A and B’s comment, Z might reply to X’s reply(on A’s comment), etc.
-What data structure could you relate the reply’s hierarchy with?
-Write the Rest API structure -> Given input postId, return all comments and replies to that post, maintaining the order.
-JSON which will be returned to view.
-Write the render method. Code to extract the details from db and return the required result?
-Discussions on DB here- sql vs noSQL .
-1Query vs joins with multiple queries.
-Points to consider & were discussed- concurrency, RAM, etc.
(Please provide/discuss answers, if you have, to these ques in the comments section below.
They hv has been asked in few other companies as well.)
Q2. How indexing works in DB? Pros and cons of various indexing?
Q3. Questions on Multithreading.
Q4. Discussion on current project & relevant questions.
Q5. Previous company related – how do handle SEV 2 situations? What if you have 150+ instances and you
need to debug your error? If you cant log in to all the hosts, how would you debug then?
Q6. How do you review the code? What all you look into if a CR comes to you?
Round 5(HM round)
Q1. Most challenging project I have ever worked on? How is scalability taken care of, in such
Q2. You are a hotel owner. How would you set a price for your hotel room? [needed a final
number and the factors considered to reach that number)
Q3. You are an engineer in a team which currently uses Oracle, but for a new project you want to
use MySQL and you are fully convinced that it is the best for your use case. How would you
convince your Lead Engineer on the same?
Q4. Situation Reversed – you are a lead engineer and a junior approaches you for using
MySQL. How would you handle the situation?
Q5. How you do code reviews in your team?
Q6. You are a manager/lead and you have been asked to deliver a project along with integration
with 5 social media handles. You estimate the project to be delivered with good quality in 3
months and with some hacks etc in one month. But business wants that project to be delivered
in a week. Now questions asked on this were – What would you do? Would you go ahead with
the hacky code? How would you handle the situation? And more questions.
Q7. Why leaving you current company?
Q8. Why oyo?
PS: Interviewers looked for optimized solutions to all coding problems.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.