344. Reverse String 反转字符串
来源:互联网 发布:超图软件股票最新消息 编辑:程序博客网 时间:2024/06/07 19:14
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==""||s==null) {return s;} char [] str = s.toCharArray(); char [] strstr = new char[str.length]; String string = ""; for(int i = str.length-1;i>=0;i--) { strstr[str.length-1-i] = str[i]; } return new String(strstr);}}
时间复杂度:o(n)
空间复杂度:o(n)
0 0
- 344. Reverse String 反转字符串
- Reverse String 字符串反转
- LeetCode----344. Reverse String 字符串反转
- [LeetCode]344. Reverse String(反转字符串)
- leetcode 344. Reverse String 反转字符串
- String reverse字符串的反转
- 字符串反转--Leetcode Reverse String
- reverse a string反转字符串
- LeetCode Reverse String(字符串反转)
- LeetCode——344. Reverse String(字符串反转)
- [Leetcode,python] Reverse String 反转字符串
- leetcode Reverse String II 反转字符串
- Leetcode 344 Reverse String 反转字符串
- LeetCode--Reverse String 反转字符串(Python)
- leetcode 541. Reverse String II 反转字符串
- leetcode解题之344. Reverse String & 345. Reverse Vowels of a String Java版(反转字符串)
- LeetCode Reverse Words in a String(反转字符串)
- LeetCode Reverse Words in a String(反转字符串)
- SHA算法原理
- Objective-c 内存溢出问题经验汇总
- DES加密算法原理
- AES加密算法原理
- OpenSSL库概述
- 344. Reverse String 反转字符串
- 大数运算库简介
- Base64编码解码原理
- MVP模式介绍
- VIPER模式介绍
- bootstrap-datetimepicker 汉化
- 强制消除Xcode警告的方法
- Android不同应用间的活动和服务的数据同步
- SQLite3中的数据类型