It was a 3 hour long contest and we were given one problem to solve in the given time.
Every point in the universe is represented by (x, y) co-ordinates . The distance between two points -(x1, y1) and (x2, y2) can be calculated as abs(x1-x2)+abs(y1-y2) . Now there are n warmholes,
Every warmhole is described by 3 details . — co-ordinates of one end of warmhole, co-ordinates of other end of warmhole and cost of traveling through the warmhole. Now we are given a source and a destination and we have to calculate minimum time to go from source to destination by using any number of warmholes (possibly zero).
N<=5 (number of warmholes)
Co-ordinates of every point: (x, y) x<=1000, y<=1000
This problem can be solved by constructing the adjacency matrix and then applying any shortest path algorithm, I used Floyd Warshall.
28 students were shortlisted after this.
First technical round (F2F):
First of all the interviewer asked about my project. He wanted to know about the details so we had a long discussion of about 20 -25 minutes on this.
Then he gave me some conditions and asked how I would have handled those conditions and what changes were necessary in my project to satisfy those conditions .
He asked me one very simple question on DS, it was spiral traversal of a matrix – Print matrix in spiral form
He then switched to Operating System questions
1. Difference between mutex and semaphores: https://www.geeksforgeeks.org/mutex-vs-semaphore/
2. What is a critical section: https://www.geeksforgeeks.org/g-fact-70/
3. What are system calls. Name some popular system calls. Why are they necesaary?
4 What is a kernel?
5. Different solutions to critical section problem and how they work.
6. Code and explanation using diagram of Peterson solution.
This round was almost 1 hr long. He was a very senior interviewer and asked lot of things related to my 3 years in the college.
Second technical round (F2F):
The interviewer asked me if I knew what BSTs and heaps are.
He asked me which of the two will be used for priority based scheduling. Then he asked me the time complexity for deletion of any key in a heap and the actual algorithm to do it.
He asked me about sampling and quantization (Computer Networks).
He asked me some more questions on Networks and I told him I did not know much about it.
Next, he asked me if I knew what trie data structute is. I replied positively and he asked me the following questions:
1. How will you know the actual number of nodes required in the trie without actually constructing the trie. I gave him an answer by sorting the strings lexographically. He asked me how I arrived at the approach and he was satisfied by my approach.
2. Given a matrix of (n*m) where n<=1000 && m<=1000 . Every cell has either 0 or 1.
The question was to find if two rows are identical or not. First of all I came with a very naive solution by making strings out of each row and maintaing a hash map to check whether a string pattern occurs more than once. He asked for an optimized solution and I finally came up with a solution using binary trie. He was looking for this solution and he was satisfied.
He gave me another question and asked me how will I determine if a number is an exact power of 2 . Numbers are 64 bit numbers, first I gave him a solution using looping and finally a one liner solution that he was looking for i.e if (number)&(number-1)==0, then the number must be an exact power of 2 .
1. What is a zombie process: https://www.geeksforgeeks.org/zombie-and-orphan-processes-in-c/
2. Write code in C to create a zombie process.
3. How to avoid a zombie process.
He asked me a very famous puzzle: https://www.geeksforgeeks.org/puzzle-1-how-to-measure-45-minutes-using-two-identical-wires/
I was not able to answer it.
He then asked me a general question that why are man holes cover round and not square in shape.
It was a pure HR round .
I was asked what do you know about our work .
Why Samsung and if not Samsung then which company?.
Questions on family background and if I was okay with the location.
At last he told me the total salary breakup.
All the interviewers were very supportive and made me very comfortable.
Results were announced after a while.
Total 8 people were selected and I was one of them .