Leetcode no. 344
来源:互联网 发布:高分少女 知乎: 编辑:程序博客网 时间:2024/05/17 07:04
344. 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.length()==0) return s; char[] c= s.toCharArray(); int i=0, j=c.length-1; while (i<j){ char tmp= c[i]; c[i]=c[j]; c[j]=tmp; i++; j--; } return new String(c); }}
0 0
- Leetcode no. 344
- LeetCode--No.344--Reverse String
- LeetCode No.11 ~No.12
- Leetcode NO.78 Subsets
- Leetcode NO.77 Combinations
- Leetcode NO.46 Permutations
- 【leetcode】No. 235 LCABST
- LeetCode no. 35
- Leetcode no. 37
- Leetcode no. 279
- Leetcode no. 335
- Leetcode no. 283
- Leetcode no. 181 (sql)
- Leetcode no. 40
- Leetcode no. 238
- Leetcode no. 26
- Leetcode no. 80
- Leetcode no. 228
- 设计模式 - Strategy模式
- Intent传值的使用
- Android ColorState使用
- android studio如何导包
- 蓝牙4.0
- Leetcode no. 344
- 牛客网算法学习记录-链表2
- 请求编码与响应编码
- MQ基础
- SVN出现!和!M问题
- Android 同步网络时间
- 多重背包
- BOBSLEDDING
- 高通平台进FFBM的三种模式