Round 0: (Written): 20 MCQs + 2 Coding Questions:
MCQs - Topics:
- OS - Page fault, Waiting time (RR Scheduling), Paging, Semaphores, etc.
- DS – Hashing (simple chaining based numerical)
- Aptitude – 1 Probability question, Puzzle – 1 question, C– 2 questions, etc.
- Given a list of n strings group all anagrams together Example: i/p: cat act pat mad dog god o/p: cat act pat mad dog god
- Given a binary square matrix of size n, find the size of largest region i.e. find a region of connected ones (horizontally, diagonally, vertically).Example: i/p: 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 0 o/p: 5
- Reverse a linked list.
- I gave two approaches, one using stack and one using pointers (in-place).
- Print top view of a binary tree.
- Well simple question but don’t know why I started using DFS approach (Pre-Order Traversal)
- Tried using pre-order but he gave me test cases where it failed.
- Tried different approaches within pre-order found issues with one or the other test cases and I was also using HashMap to keep track of nodes to print.
- So he asked me to do it without auxiliary storage.
- I tried level order approach (w/o auxiliary HashMap)and it worked fine for all test cases.
- He was satisfied with the approach, so asked me to write production level code.
- Find Kth Max occurring element in the Array.
- Used HashMap and Heap to solve the question.
- Time O(n*logn)
- DP question: Special Keyboard
- Given a string find a repeating substring of maximum length. Example: i/p 1: banana o/p 1: ana i/p 2: indiaindianttindiaindia o/p 2:india india I thought of using KMP but complexity was high with this approach. I tried using Longest Common Substring to see if there is any pattern or way to solve it using LCS, I found an approach told it to the interviewer he was very happy with the approach.
- Given an infinite integer number line, find minimum steps required to reach a particular point. 0 is the starting point and at ith step we can move +i or -i steps from current position. Tried using tree and realised it is DP problem told him the approach and complexity and why DP and why BFS (to get minimum steps).He was satisfied with the approach.