leetcode 344. Reverse String

abcjob發表於2021-09-09

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

public class Solution {
    public String reverseString(String s) {
         if(s==null || s.length()==0){
            return s;
        }
        int left = 0;
        int right = s.length()-1;
        char[] sChar = s.toCharArray();
        while(left

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4798/viewspace-2807399/,如需轉載,請註明出處,否則將追究法律責任。

相關文章