[LeetCode]344. Reverse String

来源:互联网 发布:java什么是逻辑或 编辑:程序博客网 时间:2024/06/15 01:31

Write a function that takes a string as input and returns the string reversed.

Example:

Given s = “hello”, return “olleh”.

代码长这样~

class Solution {    public String reverseString(String s) {        return new StringBuffer(s).reverse().toString();    }}

咦,我刚做完557就来做这道题,它要是早点出现我也不会写557写了那么久(;′⌒`) 摔桌

原创粉丝点击