344. Reverse String

xiaoxiao2021-02-28  104

题目:

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

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

思路:

本题使用C++ 标准库函数 reverse即可,详情请戳:点击打开链接

代码:

class Solution { public: string reverseString(string s) { reverse(s.begin(),s.end()); return s; } };

转载请注明原文地址: https://www.6miu.com/read-42880.html

最新回复(0)