Online Test: 9th Sept 2020
Interview: 10th Sept 2020
Written Test: First of all 230 students were selected by Procol, Gurugram from a pool of 600+ eligible students on basis of resume.
The online test consists of 2 sections:
21 MCQ’s: MCQ’s were based on concepts of networking, operating systems, MySQL and oops.
3 coding questions, coding questions:
- Concatenate n strings from the index where a vowel occurs.
Input Strings: abcde, bcdef, fgkl, dseiou Output String: abcdeefeiou
The simple bruteforce O(n) approach worked (where n is the total length of all the strings combined). I did this question.
- Minimum changes required to make all the numbers in an array prime.
I solved this question using Digit DP. Idea was to calculate all the primes using a sieve then make 2 arrays which defined the distance of a particular number from the left and right of a prime number. Now for every query simply the minimum of both arrays was our answer.
- Given an array A of N numbers, you have to perform B operations. In each operation, you have to pick any one of the N elements and add the original value(value stored at index before we did any operations) to its current value. You can choose any of the N elements in each operation.
Perform B operations in such a way that the largest element of the modified array(after B operations) is minimised. Return an integer corresponding to the minimum possible largest element after K operations.
Input: A = [1, 2, 3, 4] B = 3 Output: 4
Explanation: After the 1st operation the array would change to [2, 2, 3, 4] After the 2nd operation the array would change to [3, 2, 3, 4] After the 3rd operation the array would change to [4, 2, 3, 4]
A : [ 8, 6, 4, 2 ] B: 8 The expected returned value: 12
I was not able to solve this problem completely and 2 out of 3 test cases were run.
23 out of 230 students were selected for the Virtual Interview process on 10th Sept.
Interview: There were 2 rounds of interviews and both were technical.
Tips: Please have a good internet connection, broadband is preferred as I connected with my cellular 4G but the voice of the interviewer was breaking, and we had to reschedule the interview.
- It started with a discussion of my projects and internship.
- How to find if a number is the power of 2 or not. First I told the brute-force approach then told the bit manipulation approach of x&(x-1) must be 0 to be a power of 2.
- Are you familiar with the stack? I said Yes.
- Describe it and what are the stack operations? Explained
- How to implement stack? I explained using the linked list approach.
- Why can’t we use arrays? Explained the static nature of arrays
- On the further discussion on implementation with the linked list, we found that pop operation would be costly. So how to make it efficient? I suggested the reverse linked list method, to make a stack using a reverse linked list. He was convinced.
- Do you know SQL? Yes sir.
- What are the joins? Explain left outer join. Explained
- What is context Switching? I explained something, but I was sure I am wrong, so told I am not able to remember.
- Given an unsorted array, find two pairs such that the sum of the pairs is k. First I gave a brute-force approach of O(n^2). Then told a better approach by hashing.
- Given a sorted binary array whose size could be as big as 10^14. We don’t know the size of the array and also we cannot find it. Find the occurrence of first “1” in the array.
I stumbled on this question as we cannot find the size or we could have done a simple binary search. So I came with a redefined binary search where first we can check every 100,000th number can see if it is 1 or not, If it is then we are sure our first 1 is this or on the left part of the array so simply do a binary search from this index to 100,000 indexes left.
- Can we optimize it?
After some thinking, I told to instead of keeping a gap of 100,000 we could use an exponential gap. Like for example, I suggested taking the 2^i gap which increases readily thus we can reach our 1st “1” faster. Accounting it to O(logN) algorithm. He was impressed.
- What is Normalization in DB,S? Answered
- What is LRU cache? How to implement it? Any real-life example where LRU is used? Answered
- Swap two numbers with taking additional 3rd variable? I suggested a method using bit manipulation.
x = y ^ x^ (y=x);
He told me to run it using some test cases including negative numbers and it executed successfully.
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.