344. Reverse String

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

Example:
Given s = "hello", return "olleh".

一刷
题解:two pointer

public class Solution {
    public String reverseString(String s) {
        char[] chs = s.toCharArray();
        int l = 0, r = s.length()-1;
        while(l

你可能感兴趣的:(344. Reverse String)