LeetCode——344. Reverse String(字符串反转)

来源:互联网 发布:五山到软件路13 编辑:程序博客网 时间:2024/06/01 14:14

题目链接


题目:

344. Reverse String

DescriptionHintsSubmissionsDiscussSolution
DiscussPick One

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

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


解题:

反转一下,应该是考察倒序输出吧。

代码:

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



阅读全文
0 0
原创粉丝点击