Google Interview Question

Write a function that receive 3 numbers and return the medium number

Interview Answers

Anonymous

Jan 21, 2013

It is easier to find the minimum and maximum of the three numbers (say, a, b, c). minimum = min(min(a, b), c) maximum = max(max(a, b), c) So, median becomes: median = (a+b+c) - minimum - maximum

12

Anonymous

Jan 15, 2013

Probably he wants to hear about different ways of sort and not simple if(a