I gave 3 technical interviews. Most of the questions were easy. Some questions were based on my internship.
No HR interview.
Here are a couple of questions from the interview that I remember:
- Find the second minimum element in an array? It can easily be done by using 2n comparisons but they asked me to reduce the number of comparisons. It can be done in (n+logn) comparisons. (n/2 + n/4 + n/8 +…..) = n comparisons to find the minimum element in the array (divide and conquer approach) ,logn comparisons to find the second minimum.
- You are given a k-ary tree. Each node can have less than or equal to k children. Store the tree in an array such that you can create the tree back from the array. Just like a binary tree where the children are 2*i+1 & 2*i+2, here the children will be k*i+1, k*i+2,…,k*i+k. I was asked to write a working code for all the questions they asked.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above