14th September – Online test
• 50 MCQ questions (mixed, ds algo, aptitude)
• One coding questions. Don’t remember exactly what the question is, but something related to finding numbers that are less than N (1<N<10^18) that are divisible by both 3 and 6 or something like that.
17th September – First Technical Round
Three coding questions. Main focus was on approach and optimization. First, I told my approach then the interviewer asked me to write code for the same. After code, space and time complexity was asked. Also, he asked me if this is the most optimized code or is there any scope for further optimization.
Find the longest common prefix.
• Leetcode - https://leetcode.com/problems/longest-common-prefix/
• First, I come up with a O(n^2) approach, later he asked me to optimise the code. Then I came up with a O(n*l) approach, where ‘l’ is the longest prefix.
• Told both time and space complexity for the program.
Find all permutations of given string.
• Similar Leetcode problem - https://leetcode.com/problems/permutations/
• Gave the recursive approach and wrote clean code with O(n*n!) time complexity.
Find if there is any cycle in LinkedList list, if any, return the value, else -1. Interviewer told me that the values of nodes will be greater than 0.
• Similar Leetcode problem - https://leetcode.com/problems/linked-list-cycle/
• I told him that we can store the visited nodes in HashMap and if we visit the node again then we will return the value of the node.
• Time complexity – O(n) and space complexity – O(n).
• Asked me if I can optimize it further, I gave solution with O(n) time and O(1) space complexity.
Got rejection mail the same day. Didn't know what went wrong. :(