LeetCode 344. Reverse String(字符串翻转)
来源:互联网 发布:db2和sql server 编辑:程序博客网 时间:2024/05/17 08:21
原题网址:https://leetcode.com/problems/reverse-string/
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
方法:循环。
public class Solution { public String reverseString(String s) { if (s == null) return null; char[] sa = s.toCharArray(); char[] r = new char[sa.length]; for(int i=0; i<sa.length; i++) r[i] = sa[sa.length-1-i]; return new String(r); }}
0 0
- LeetCode 344. Reverse String(字符串翻转)
- leetcode-344. Reverse String 字符串翻转,切片的用法
- LeetCode 541. Reverse String II (字符串翻转)
- LeetCode 344: Reverse String (字符串翻转)
- Reverse String 翻转字符串
- leetcode 151. Reverse Words in a String 字符串 翻转
- LeetCode oj 344. Reverse String(字符串)
- LeetCode刷题:Reverse Words in a String(翻转字符串中的单词)
- LeetCode OJ 之 Reverse Words in a String (翻转字符串的单词)
- 【leetcode】 Reverse Vowels of a String(翻转字符串中出现的元音字母)
- LeetCode 557. Reverse Words in a String III (字符串翻转)
- 字符串-Reverse Words in a String(翻转字符串)
- Reverse Words in a String 翻转字符串
- JavaScript实现-字符串翻转-Reverse a String
- Python翻转字符串(reverse string)详解
- 翻转(reverse)字符串(string)的所有方法
- JavaScript实现-字符串翻转-Reverse a String
- LeetCode——344. Reverse String(字符串反转)
- 强引用和弱引用
- armeabi和armeabi-v7a的区别
- 又是二分(避免死循环)
- [Zlib]_[初级]_[使用zlib库压缩文件]
- C++异常处理
- LeetCode 344. Reverse String(字符串翻转)
- ZOJ_1009
- 对copy/strong/weak/__weak/__strong/assign的使用场景总结总结
- 搭建MSSM环境之——安装Maven
- 用R语言把超大文本文件拆分成几个小文本文件
- 常用的内存操作函数
- 强引用和弱引用
- Qt简单编程--对话框式进度条
- 基于AST抽象语法树的SQL注入检测 (2) -- 每周小结(01-02~01-08) - .Little Hann