Pergunta de entrevista da empresa Microsoft

Write a function to reverse a String. I asked if I could use Java which the interviewer said was fine. After writing half the code he indicated that I actually should have written the algorithm for a character array. Ughh, I really screwed this one up but I feel like the question should have been administered better.

Resposta da entrevista

Sigiloso

4 de nov. de 2012

Hi, maybe this could be done in-place using two indices: one to the beginning of the character array and the last to the end of the character array then proceeding by incrementing the first and decrementing the latter (and by swapping each couple of values till the indices overlap for a even or odd number of characters string). Sorry you didn't make it, but thank you for sharing!

1