题解 | #反转字符串#
反转字符串
http://www.nowcoder.com/practice/c3a6afee325e472386a1c4eb1ef987f3
class Solution {
public:
/**
* 反转字符串
* @param str string字符串
* @return string字符串
*/
string solve(string str) {
int start;
int end;
int i;
string result="";
if(str.length()==0){
result="";
}
else{
for(i=str.length()-1;i>=0;i--){
result+=str[i];
}
}
return result;// write code here
}
};