Question d’entretien chez Microsoft

Write a function that reverses an array.

Réponses aux questions d'entretien

Utilisateur anonyme

6 janv. 2018

What areas did the Skype interview cover?

2

Utilisateur anonyme

19 déc. 2017

I wrote my function in C++, using a std::vector instead of a C array. The reversal is performed in-place using iterators. template void reverse(std::vector& v) { if (v.size() > 1) for (auto i1 = v.begin(), i2 = v.end() - 1; i1 < i2; ++i1, --i2) std::iter_swap(i1, i2); }