Round 1 (Technical Interview) – Three coding questions were asked along with some C++ output questions.
- https://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list/ – I was asked to scale the implemented logic for k > 2. ( Similar to this question: https://www.geeksforgeeks.org/reverse-a-list-in-groups-of-given-size/)
- https://www.geeksforgeeks.org/kth-largest-element-in-bst-when-modification-to-bst-is-not-allowed/
- https://leetcode.com/problems/keys-and-rooms/
- C++ output questions were asked based on constructor and destructor.
Round 2 (Logical Interview) – Some mathematical questions were asked to check the logical ability.
- In a group of 7 boys and 5 girls, four children are to be selected. Find the number of ways that they can be selected such that at least one boy is always there.
- Two dice are rolled together. Find the probability of getting a difference of 1 between the numbers that show up on the dice.
- Puzzle: https://www.geeksforgeeks.org/puzzle-heads-or-tails/
- Asked to get the time complexity of below function. Check if it can be optimized, if yes then get the time complexity of the optimized function.
C++
unsigned int power( unsigned int x, unsigned int n) {
if (n == 0) return 1;
if (n%2 == 0) return power(x,n/2) * power(x,n/2);
else return x * power(x,n/2) * power(x,n/2);
}
|
Round 3 (Technical Interview) –
- 4D tensor stored in 1D array : Convert NCHW -> NHWC
Input: N=1, C=3, H=2, W=2 -> 1 2 3 4 5 6 7 8 9 10 11 12
Output: N=1, H=2, W=2, C=3 -> 1 5 9 2 6 10 3 7 11 4 8 12 - https://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/
- https://www.geeksforgeeks.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/
- Implement align_Malloc(int size, int align) such that it accepts number of bytes to be allocated and alignment. Ex: if align = 10, and malloc function returns address 123, then return either 120 or 130.
- Question based on structure padding and offset operator was asked.
- Puzzle: There is a tennis tournament of 128 players. They share a transitive property among themselves, if A beats B, B beats C then A will beat C. Find out the min number of matches required to get the best and second best player among 128. [Main focus was to get the second best player]
Round 4 (Technical + Behavioral Interview)
- I was asked about my projects of which I am proud of. Then they ask about the challenges I faced, what I learnt etc.
- Some C++ output questions were asked based on virtual function concept and copy constructor concept.
- https://www.geeksforgeeks.org/swap-two-numbers-without-using-temporary-variable/
- Write a multi threaded C code with one thread printing all even numbers and the other all odd numbers. The output should always be in sequence i.e.. 0,1,2,3,4….etc.
[ https://gist.github.com/jmurudi/7a2fc49e855cb0b308d19f277c7e12b7 ] – interviewers wanted to check the concept of multi-threading, mutex, condition variable etc.
Round 5 (Technical + Behavioral Interview)
- Some questions on my projects were asked – roles and responsibilities, what you learnt, any improvement or modification done from your side etc.
- Difference between mutex and semaphore as some of my projects were based on multi-threading.
- What issue can occur if two threads are trying to access the same resource? -> I answered about the undefined behavior, order of execution can results differently. Asked to explain some example.
Then I was asked to think of any other issue. -> Deadlock can occur. - Condition for deadlock, how we can avoid the deadlock?