Cutoff for applying for it in BITS Pilani – 7 for CS, 8 for EEE, ENI
2 Questions in 50 minutes. The questions were moderate however the time constraint added to the difficulty.
Question 1. Given an array of N numbers greater than or equal to zero corresponding to the number of stones at each position, find the minimum number of moves to distribute these stones such that each position has one stone at the end.
The total sum of the given array is equal to N.
A move consists of moving any number of stones from one index to the adjacent one.
Input – [0 2 1 3 0 0]
Expected Output – 3
Explanation – Step 1: Shift 1 stone from index 1 to index 0 [1 1 1 3 0 0]
Step 2: Shift 2 stones from index 3 to index 4 [1 1 1 1 2 0]
Step 3: Shift 1 stone from index 4 to index 5 [1 1 1 1 1 1]
Question 2. A complexly worded question that was to be solved using DFS.
Out of 197 people that appeared, 22 were shortlisted.
Technical Round 1
The interviewer was pretty chill and we first had a discussion about the project that I had done over the summer.
He also discussed a little about the company with me at the start.
After that I was asked to implement the history feature in google chrome that should support the following operations:-
2. Deletion of a particular instance of the specified url. For eg. you might have google.com a 100 times, but you might want to delete one instance of it.
3. Print the history in reverse order i.e. recently visited urls first as you would expect in chrome.
4. Find (if you’re searching for “apple” then you should get both apple.com and facebook.com/apple as the result if both were in the history.)
I implemented this using a doubly-linked list and a map. He was satisfied with my answer and we moved on to a question of DBS.
I was supposed to make a proper schema for something similar to facebook groups that would support posts comments, likes and also only members of the group can access the posts. Once I was done with the schema, he asked me to normalize it. I went through 1 NF to BCNF one by one and as it turned out, the schema already satisfied all the requirements of the 4 schemas. I was going to continue to 4NF and 5NF but he stopped me there and told me that usually in real world problems we stop at BCNF.
He then gave me a scenario for the database and asked me to write the SQL query for it. The answer involved 4 joins and the use of an aggregate function(count).
This was followed by a question of N magnets placed on a line at regular intervals of d. Given that magnetic force is inversely proportional to distance, I was supposed to find all the points where the force cancels out.
My first instinct was that there would only be one point in the middle however the interviewer asked me to review my thought process. I then implemented my solution using binary search and was asked to calculate the time complexity for the same.
There were a few other questions that I don’t recall.
Towards the end he asked me if I had any questions for him and then discussed a little about my career aspirations.
Technical Round 2
This round was a little more taxing with 2 interviewers throwing questions at me one by one.
Some questions that I remember:-
1. Stock selling problem, all 3 variations one after the other – 1 transaction allowed, any no. of transaction allowed, k transactions allowed.
2. Find the number of substrings of a string that contain a character at least once.
3. What’s the use of free in C? Explain the exact functionality.
4. What is static keyword in C++? Does it exist in C?
5. Compile time polymorphism vs run time polymorphism.
6. Find the maximum element of a given array from index l to r. (Not brute force, optimize it)
I was the first one called for the HR round and didn’t know what to expect. He asked me about my experience from the online round to the final round. Then he started discussing about the company and its work and asked me about my dream companies. It was chill and barely lasted for 10 minutes.
Result – All 3 of us who were called for the HR were selected.
Sources of preparation – Interviewbit and Geeksforgeeks for DSA, Javatpoint and lecture slides for OOP, lecture slides and GeeksforGeeks for DBS