LeetCode 344. Reverse String 题解(C++)
2016-09-27 19:07
399 查看
LeetCode 344. Reverse String 题解(C++)
题目描述
Write a function that takes a string as input and returns the string reversed.示例
Given s = “hello”, return “olleh”.代码
class Solution { public: string reverseString(string s) { string str = s; int length = s.size(); for (int i = length - 1; i >= 0; --i) { str[length - 1 - i] = s[i]; } return str; } };
相关文章推荐
- [LeetCode-344]Reverse String(c++)
- leetcode_c++: Reverse String(344)
- leetcode_344_ Reverse String(C++)(easy)
- LeetCode 344:Reverse String (c++)
- leetcode 344. Reverse String 题解
- 【LeetCode-344】 Reverse String(C++)
- <LeetCode>344. Reverse String
- LeetCode 344. Reverse String(字符串翻转)
- LeetCode 344. Reverse String
- Leetcode Reverse String 344
- LeetCode题解:Range Sum Query - Immutable(C++版)
- [leetcode] 344. Reverse String 解题报告
- LeetCode 第 344 题(Reverse String)
- LeetCode题解汇总(C++ Java Python,含题目翻译)
- LeetCode笔记:344. Reverse String
- LeetCode-344.Reverse String
- LeetCode 344 Reverse String
- LeetCode题解:Range Sum Query - Immutable(C++版本)
- leetcode Minimum Depth of Binary Tree C++题解
- LeetCode 第 344 题(Reverse String)