【LeetCode】 344. Reverse String

来源:互联网 发布:帝国cms首页模板代码 编辑:程序博客网 时间:2024/06/16 13:15

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


0 0
原创粉丝点击