Frage im Vorstellungsgespräch bei Microsoft

Write a function that reverses an array.

Antworten zu Vorstellungsgespräch

Anonym

6. Jan. 2018

What areas did the Skype interview cover?

2

Anonym

19. Dez. 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); }