Question d’entretien chez Bloomberg

Rotate array by n elements. Sort names based on last name.

Réponses aux questions d'entretien

Utilisateur anonyme

20 janv. 2015

Rotating the array by N elements - there is a nice trick to do this in place: - invert the entire array - invert first N items (or last, depending if rotating right or left) - invert rest of the array I found this trick initially to rotate strings, but can be used for arrays as well.

3

Utilisateur anonyme

15 mars 2015

What would be the time complexity? O(n)??