力扣简344 反转字符串

 

 

 

class Solution {
    public void reverseString(char[] s) {
        for(int i=0,j=s.length-1;i<j;i++,j--) {
            char temp=s[i];
            s[i]=s[j];
            s[j]=temp;
        }
    }
}

 

posted @ 2023-02-22 11:27  Ssshiny  阅读(14)  评论(0)    收藏  举报