<LeetCode>344. Reverse String
2016-04-29 19:16
405 查看
344. Reverse String
My SubmissionsQuestion
Editorial Solution
Total Accepted: 10975 Total
Submissions: 18784 Difficulty: Easy
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
Subscribe to see which companies asked this question
Show Tags
Show Similar Problems
Have you met this question in a real interview?
Yes
No
Discuss
我的解法就是一般的一个一个拆开再赋值:
class Solution { public: string reverseString(string s) { string s1; int i; for(i=s.length()-1;i>=0;i--){ s1+=s[i]; } return s1; } };我还在想其他的好方法,谢谢大家啦^_^
相关文章推荐
- 解一元多次方程
- 学习心得(一)
- hdu 4652(概率dp)
- 如何利用反射机制实现前台页面共用一个servlet文件
- bzoj 1858: [Scoi2010]序列操作
- POJ 3270 置换群
- LightOJ - 1374 Confusion in the Problemset (模拟)
- mysql 变量
- ThinkPHP单字母函数汇总
- 反射
- 冲刺第十天
- 1.项目大致架构设计
- android.view.WindowManager$BadTokenException: Unable to add window — token null
- Scrum 团队成立 -- 软件工程
- hdu-1285拓扑排序
- 冲刺7
- MAC卸载/删除 Parallels Desktop虚拟机的方法
- 【7】Zabbix WEB指标监控
- Java 内部类的一些总结
- 实验十一 路由器综合路由配置