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. 应用IBatisNet+Castle进行项目的开发

    最近在做一个项目,项目的需求不够明确,这是做项目的大忌,但是没有办法.项目的架构采用Dotnet平台使用C#进行开发,为了加快项目的开发进度,采用代码生成工具之MyGeneration 生成业务基本代 ...

  2. Web的本质以及第一个Django实例.

       Web框架的本质:    所有的Web应用本质上就是一个socket服务器, 而用户的浏览器就是一个socket客户端. import socket sk = socket.socket() s ...

  3. hdu 4055(经典问题)

    总是不能正确的将一个大问题变成子问题,而且又找不到状态转移方程. 直接导致这题想了5个小时最后还是无果... 谨记! Number String Time Limit: 10000/5000 MS ( ...

  4. [LintCode] 删除链表中倒数第n个节点

    /** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode(in ...

  5. 求其中同一个主叫号码的两次通话之间间隔大于10秒的通话记录ID

    求其中同一个主叫号码的两次通话之间间隔大于10秒的通话记录ID 例如:6,7,8,9,10条记录均符合 ID 主叫号码 被叫号码      通话起始时间            通话结束时间       ...

  6. 洛谷 P4451 [国家集训队]整数的lqp拆分

    洛谷 这个题目是黑题,本来想打表的,但是表调不出来(我逊毙了)! 然后随便打了一个递推,凑出了样例, 竟然. 竟然.. 竟然... A了!!!!!!! 直接:\(f[i]=f[i-1]*2+f[i-2 ...

  7. Pandas常用操作方法

    Pandas pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的. Pandas 纳入了大量库和一些标准的数据模型,提供了高效地操作大型数据集所需的工具. pandas提 ...

  8. 我的Android进阶之旅------>Android Studio 快捷键整理分享

    正式转战Android Studio了,首先把Android Studio的快捷键摘录下来,以备后用. (官网的快捷键列表如下  https://developer.android.com/studi ...

  9. Vue(2)- v-model、局部组件和全局组件、父子组件传值、平行组件传值

    一.表单输入绑定(v-model 指令) 可以用 v-model 指令在表单 <input>.<textarea> 及 <select> 元素上创建双向数据绑定. ...

  10. python学习之路-第三天-函数

    函数 函数的定义关键字:def 使用global语句可以清楚地表明变量是在外面的块定义的 示例:(函数运行完毕后x的值是2) #!/usr/bin/python # Filename: func_gl ...