You are viewing a single comment's thread. Return to all comments →
How about this logic:
Step I. get the 3 array and reverse them, create a new array out of an existing array with each element is sum of all the previous elements.
eg: [3,2,1,1,1] -> [1,1,1,2,3] -> [1,2,3,5,8]
So the 3 new array formed would be
Step II. Again reverse the array
Step III. Take the smallest array i.e. [9,5,2]
traverse the smallest array and search element in the other 2 array - if the element is existing in other 2 array, STOP there and return the number.
Eg. Here I start with elem - 9 : Which is not existing in other 2 array.
Next I start with elem - 5 : it is existing in other 2 array.
Wolla! 5 is my NUMBER!