Reverse String
生活随笔
收集整理的這篇文章主要介紹了
Reverse String
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh"
思路:直接轉(zhuǎn)StringBuffer后reserve即可;
JAVA CODE
class Solution {public String reverseString(String s) {StringBuffer ss = new StringBuffer(s);return ss.reverse().toString();} }?
轉(zhuǎn)載于:https://www.cnblogs.com/baichangfu/p/7451309.html
總結(jié)
以上是生活随笔為你收集整理的Reverse String的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html onclick的方法里用js的
- 下一篇: jmeter--轻量级接口自动化测试框架