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. CNBlog客户端--第一阶段记录

    开始 五一小长假由于没有出去玩,所以我就用来继续写我的 CNBlog Android 客户端!首先呢!先上图!让大家看看,我做到哪儿了!! 不知道大家看了是什么感觉哈!有意见请评论哦!! 完成度以及遇 ...

  2. bzoj 1415(概率dp和bfs预处理)

    感觉挺经典的一道题目. 先用 bfs 预处理下一步走到的位置.因为每一步走法都是固定的,所以可以用dp的方法来做. 1415: [Noi2005]聪聪和可可 Time Limit: 10 Sec  M ...

  3. hdu5861(Road)

    题目链接:传送门 题目大意:有n个点 组成n-1段,每一段开着的时候都有花费Vi,有m组要求,对于每组要求 [x,y]之间可达,对于每一段你有一次开关的机会(最初都是关闭的) 问怎样安排段落得开闭时间 ...

  4. resin配置

    第一种方式:      在本机调试Resin服务,一般是在Eclipse IDE中进行,这样即可以快速的在开发环境中启动/终止Resin,又可以很方便的Debug程序.跟踪异常栈.    在任何版本的 ...

  5. Visual Studio 2010 如何改用 Beyond Compare 作为 TFS 的比较工具

    Beyond Compare 是一套非常实用的文件及文件夹比较软件,不仅可以快速比较出两个文件夹的不同之处,还可以详细的比较文件之间的内容差异.最近改用 TFS 进行版本控管之后,说实在的还是习惯使用 ...

  6. mysql 中调用存储过程之后,连接断开不可用

    解决方法: 由 mysql_real_connect(&m_mysql,host,user,passwd,Db,0,NULL,0) == NULL 改为 mysql_real_connect( ...

  7. sklearn.svm包中的SVC(kernel=”linear“)和LinearSVC的区别

    参考:https://stackoverflow.com/questions/45384185/what-is-the-difference-between-linearsvc-and-svckern ...

  8. Consistent hashing

    Download source code - 20.3 KB What is libconhash libconhash is a consistent hashing library which c ...

  9. 在docker中制作自己的JDK+tomcat镜像

    准备工作:需要Linux kernel 3.8支持 查看linux内核的版本:root@ubuntu-dev:~# cat /proc/version查看linux版本:root@ubuntu-dev ...

  10. 使用.gitignore忽略文件

    单个项目配置 在.git文件夹同目录下打开git bash,执行命令: touch .gitignore 生成“.gitignore”文件. 在”.gitignore” 文件里输入你要忽略的文件夹及其 ...