 Open in App
Not now

# 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

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: https://www.geeksforgeeks.org/ways-sum-n-using-array-elements-repetition-allowed/

2nd Ques: Find minimum swaps required to convert BT to BST.
I answered using inorder sorting method.
Solution is here: https://www.geeksforgeeks.org/minimum-swap-required-convert-binary-tree-binary-search-tree/