I had applied for Principal Engineer with Optum, part of UnitedHealth Group. I have been interviewed for only one round.
He asked me to find outlier between two array.
var1 [] = {2,5,6,7}
var2 [] = {2,6,5,}
I have solved this question by using HashSet, I will store first array and HashSet and iterate over second array.
Then he asked, what would be complexity I said (m+n) i.e. 2n.
He asked to is there any better solution on this. I said I don't know, I think it need iterate over two array and so complexity is 2n.
He said, what if elements have duplicate, I said no problem duplicate will be removed.
He gave another example of arrays.
var1[] = {1, 2, 2}
var2[]= {1,2,2,1}
He asked it should give output as 1. Again I said I will HashMap where I can store key as number and its number of occurance a as value.
Again he asked what are boundary conditions for this, I asked to elaborate on this. He said what if values are decimal, then I said we need change the program to float.
He asked me why did you make so many assumption, as senior technical engineer you should not do that. We need an engineer he has deeper thinking and then our conversion got ended by saying thanks to each other.