Bloomberg Interview Question

How would you find the largest value in an array?

Interview Answers

Anonymous

Feb 17, 2010

Pramod's answer is almost perfect. I would make one change: assign temp the first value of the array.

1

Anonymous

Mar 24, 2011

is this a joke?

Anonymous

Jan 6, 2010

You will have to use a temp variable. Assign temp to -999 (assuming there is no negative 999 in the data set or use ascii for this. I am not familiar with ascii conversions). Go through the array comparing each variable with the temp. If array variable is higher, store it into temp. Keep doing this till you reach the end. Your temp has the largest value now.