zoukankan      html  css  js  c++  java
  • 【leetcode】 344. Reverse String

    要求:将给定字符串内容倒置。

      例:输入"Hello"  输出"olleH" 

     1 public class Solution {
     2     public String reverseString(String s) {
     3         int len = s.length();
     4         char []s1 = new char[len];   
     5         for(int i = 0;i < len;i++){
     6             s1[i] = s.charAt(len-1-i);
     7         }
     8         String result = new String(s1);
     9         return result;
    10     }
    11 }
  • 相关阅读:
    053335
    053334
    053333
    053332
    053331
    053330
    053329
    053328
    053327
    053326
  • 原文地址:https://www.cnblogs.com/magicya/p/6691684.html
Copyright © 2011-2022 走看看