Online Test: There were 28 MCQs mostly based on stacks, queues, predict the output, Sorting, and Binary Trees and 2 coding questions.
1) Given a string convert it into a valid address by inserting a ‘.’ after www then insert a ‘.’ before com and if there are more characters after com then put a ‘/’ after com and then the rest of the characters.
Input: wwwgooglecomr Output: www.google.com/r
Round 1 (Interview 1): The interviewer introduced himself and asked me to introduce myself.
- Print all the pairs whose sum is equal to 0.
- He extended the question to find all the triplets with sum 0.
Round 2 (Interview 2): Coding Question
- Given n strings in ‘a/b=0.5′,’b/c=0.9’ format. Find the answer of q queries in ‘a/c’ format.
Hint: (Make a directed graph with a, b and other alphabets as vertices)
Round 3 (Interview 3):
- Tree-Based: Given a binary tree and one node is set on fire so find the time required to burn all the nodes.
- Stack Based: Given a string with ‘U’ and ‘D’. Find the number of mountains and valleys
Input: UUDDDDUDUU Output: Mountain 1 is formed by UUDD and 1 Valley by DDUDUU
The interviewer expected me to code all the questions completely and helped in between if stuck to find the optimized approach.
- Start coding after the interviewer is satisfied with your approach.
- First, clarify all the doubts and then give your solution.
- Dry run your code for multiple edge cases
- Try to write a clean code.
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.