344. Reverse String
来源:互联网 发布:深度linux 密码忘记 编辑:程序博客网 时间:2024/06/11 04:33
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.
Java Code:
public class Solution { public String reverseString(String s) { char[] sc = s.toCharArray(); int lsd = 0; int rsd = sc.length - 1; while (lsd < rsd) { char c = sc[lsd]; sc[lsd] = sc[rsd]; sc[rsd] = c; lsd++; rsd--; } return new String(sc); }}
0 0
- String:344. Reverse String
- 344.Reverse String(String-Easy)
- leetcode--344. Reverse String
- 344. Reverse String
- 344. Reverse String [E]
- LeetCode 344. Reverse String
- 344. Reverse String
- LeetCode 344. Reverse String
- 344. Reverse String
- 344. Reverse String
- 344. Reverse String
- Leetcode:344. Reverse String
- 344. Reverse String
- LeetCode *** 344. Reverse String
- 344. Reverse String
- LeetCode *** 344. Reverse String
- 344. Reverse String
- [leetcode] 344. Reverse String
- 514. Freedom Trail Hard
- 如何基于K8S打造轻量级PaaS平台
- 设计模式之工厂模式
- float数据在内存中式怎么存储的
- javaweb回顾第一篇servlet的学习和理解
- 344. Reverse String
- SpringMVC上传文件的三种方式
- python-文件下载1
- 使用REST API提交、查看和结束Spark应用
- web前端基础知识-20170502
- 关于js中的冒泡和捕获
- 关于邻接多重表
- IE浏览器下常见的CSS兼容问题
- 1095 Anigram单词