Domanda di colloquio di Amazon

String reversal in place

Risposta di colloquio

Anonimo

8 ott 2010

Assume that s is the string. Here is a C++ like solution: end= s.length()-1; first=0; While (first <= end) { t=s[first]; s[first] = s[end]; s[end] = t; first++; end— }

1