344. Reverse String

来源:互联网 发布:沈阳军区朱日和 知乎 编辑:程序博客网 时间:2024/06/05 21:54

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) {        return new StringBuffer(s).reverse().toString();    }}