Skip to content
Related Articles

Related Articles

Improve Article
Grey Orange Interview Experience 2019
  • Difficulty Level : Hard
  • Last Updated : 04 Apr, 2019

There were supposed to be 4 rounds. 1 coding and 3 face-to-face.
1st Round: Hackerrank, 4 coding questions and 1 hour limit. Not necessary to pass all 4 questions. If 2 of them have passed all the test cases then the round is cleared.
Ques 1 – Find no of 2 wheeler and 4 wheeler corresponding to every element from a given array. Example: input: [6, 3, 2]
output: [2, 0, 2]
explanation: for 6: 1 4-wheeler and 1 2 wheeler. for 3: not possible so 0. for 2: only 1 2-wheeler is possible.

Ques 2-find sum of all odd factors from a given array. Example: input: [1, 6, 9]
output: sum = 1(1) + 4(1, 3 for 6)+13(1, 3, 9 for 9) = 18

Ques 3-

Due to the time limit, I could not attend the 4th question.

2nd Round: Face-To-Face
, 4 questions.
1st Ques: given a sum and an input array. Find all possible ways that an input subarray can form the given sum. Note that you can repeat the numbers of input array any no. of times.
example: input: sum=14, array[]={1, 5, 8}. Output: 5 ways: {1, 5, 8}, {5, 5, 1, 1, 1, 1}, {8, 1, 1, 1, 1, 1, 1}, {5, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
I tried to use iteration and started to write examples and code on white board but could not get to the answer. The interviewer asked me if using recursion is possible? I tried using O(n^2) approach but still was only halfway.
Solution is here:

2nd Ques: Find minimum swaps required to convert BT to BST.
I answered using inorder sorting method.
Solution is here:

3rd Ques: Reader-Writer problem multithreading. Write the code for it.

4th Ques: SmartPointer Question. I explained the smartPointer with code that how it automatically manages the memory since the destructor always delete the ptr memory allocated and we need not call the destructor explicitly since it gets called automatically when object goes out of scope.
So, the next question asked in this was if the destructor can automatically be called then why don’t we implement the same for every class
(that is, deleting the memory allocated in destructor) and then how the smartPointer is different from that every class. Why do we need smartPointer then. This confused me.

I did not have the further rounds.

All the Best!

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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :