Pregunta de entrevista de Bloomberg

How would you find the largest value in an array?

Respuestas de entrevistas

Anónimo

17 feb 2010

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

1

Anónimo

24 mar 2011

is this a joke?

Anónimo

6 ene 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.