Reversed Strings
Complete the solution so that it reverses the string value passed into it.solution('world'); // returns 'dlrow'
#include <string>
using namespace std;
string reverseString (string str )
{
string res = "";
for (int i = (str.size() - 1); i >= 0; i--)
{
res += str;
}
return res;
}
页:
[1]