Sollicitatievraag bij Bloomberg

How would you find the largest value in an array?

Antwoorden op sollicitatievragen

Anoniem

17 feb 2010

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

1

Anoniem

24 mrt 2011

is this a joke?

Anoniem

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