LeetCode——Reverse String

Question

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

Example:

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

Answer

class Solution {
public:
string reverseString(string s) {
string str(s.rbegin(), s.rend());
return str;
}
};

LeetCode——Reverse String的更多相关文章

  1. [LeetCode] Reverse String 翻转字符串

    Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

  2. LeetCode Reverse String

    原题链接在这里:https://leetcode.com/problems/reverse-string/ 题目: Write a function that takes a string as in ...

  3. [LeetCode] Reverse String II 翻转字符串之二

    Given a string and an integer k, you need to reverse the first k characters for every 2k characters ...

  4. LeetCode Reverse String II

    原题链接在这里:https://leetcode.com/problems/reverse-string-ii/#/description 题目: Given a string and an inte ...

  5. [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母

    Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...

  6. LeetCode: Reverse Words in a String:Evaluate Reverse Polish Notation

    LeetCode: Reverse Words in a String:Evaluate Reverse Polish Notation Evaluate the value of an arithm ...

  7. [LeetCode] 344 Reverse String && 541 Reverse String II

    原题地址: 344 Reverse String: https://leetcode.com/problems/reverse-string/description/ 541 Reverse Stri ...

  8. LeetCode Javascript实现 344. Reverse String 292. Nim Game 371. Sum of Two Integers

    344. Reverse String /** * @param {string} s * @return {string} */ var reverseString = function(s) { ...

  9. LeetCode Reverse Words in a String III

    原题链接在这里:https://leetcode.com/problems/reverse-words-in-a-string-iii/#/description 题目: Given a string ...

随机推荐

  1. PhoneGap 第一个程序

    首先,现在PhoneGap  ZIP包. index.html <!DOCTYPE HTML lang="zh-CN"> <html> <head&g ...

  2. iOS 状态栏更改为白色

    如果觉得在iOS 7启动期间状态栏黑色不合你意,以下方法可改变Status bar style成白色 在工程的plist添加 Status bar style,改变style值 默认是Gray sty ...

  3. python3 简单爬虫

    爬取虎牙直播分类页面的主播的头像,名字,人气 今天学习了python3爬虫,上课闲着无聊,自己写了一个爬虫 就顺着老师思路 爬了虎牙直播分类页面的主播,头像,名字,和人气 HuYaCateScrapy ...

  4. mysql_注入语句

    查看mysql中所有的用户及权限(只有root权限才能看). mysql> select distinct concat(user,host) from mysql.user; ======== ...

  5. 4.php奇葩的地方,反引号``

    今天我发现我从来没打过这外符号 ` 就是键盘的左上方, 1的左边不需要组合键, 直接按下即可.... 刚开始我还一直在找没找到.....百度一下.才知道

  6. macro-name replacement-text 宏 调试开关可以使用一个宏来实现

    C++ 预处理器_w3cschool https://www.w3cschool.cn/cpp/cpp-preprocessor.html C++ 预处理器 预处理器是一些指令,指示编译器在实际编译之 ...

  7. attributes["wv"].nodeValue

    w 获取自定义属性的值 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&qu ...

  8. IO 包中的其他类

    打印流 PrintWriter 和 PrintWriter 直接操作输入流和文件 序列流 SequenceInputStream 对多个输入流进行合并 操作对象 ObjectInputStream 和 ...

  9. windows7下搭建django开发环境

    Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 Web 应用程序框架. 使用 Django,我们在几分钟之内就可以创建高品质.易维护.数据库驱动的应用程序. ...

  10. mybatis12一级缓存

    验证一级缓存的存在 对应的实体类 /** *学生对应的实体类 */ public class Student { private Integer sId; private String sName; ...