您的位置:首页 > 其它

<LeetCode>344. Reverse String

2016-04-29 19:16 405 查看


344. Reverse String

My Submissions

Question
Editorial Solution

Total Accepted: 10975 Total
Submissions: 18784 Difficulty: Easy

Write a function that takes a string as input and returns the string reversed.
Example:

Given s = "hello", return "olleh".

Subscribe to see which companies asked this question

Show Tags

Show Similar Problems

Have you met this question in a real interview?

Yes

No

Discuss

我的解法就是一般的一个一个拆开再赋值:
class Solution {
public:
string reverseString(string s) {
string s1;
int i;
for(i=s.length()-1;i>=0;i--){
s1+=s[i];
}
return s1;
}
};
我还在想其他的好方法,谢谢大家啦^_^
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: