Question d’entretien chez Bloomberg

How would you find the largest value in an array?

Réponses aux questions d'entretien

Utilisateur anonyme

17 févr. 2010

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

1

Utilisateur anonyme

24 mars 2011

is this a joke?

Utilisateur anonyme

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