【LeetCode】344.Reverse String_EASY(五)
2017-04-06 22:54
441 查看
344.Reverse String
Description:
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = “hello”, return “olleh”.
反向字符串。
代码:
完成。
Description:
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) { char[] word=s.toCharArray(); char[] newWord=new char[word.length]; for(int i=word.length,j=0;i>0;i--){ newWord[j]=word[i-1]; j++; } return new String(newWord); } }
完成。
相关文章推荐
- leetcode_344_ Reverse String(C++)(easy)
- 【leetcode】【Easy】【344. Reverse String】【string】【two pointers】
- leetcode_easy 344、reverse string
- [leetcode][easy]344. Reverse String
- [LeetCode]-344. Reverse String(Easy)(C)
- Leetcode 344. Reverse String (Easy) (cpp)
- 344. Reverse String (Easy)
- leetcode 344. Reverse String
- Leetcode:344. Reverse String
- leetCode 344. Reverse String 字符串
- leetcode note--leetcode 344 Reverse String
- LeetCode:344. Reverse String
- 【LeetCode】344. Reverse String 解题报告
- [Leetcode从零开刷]344. Reverse String
- Leetcode 344. Reverse String
- LeetCode-344. Reverse String-Java
- [LeetCode]344. Reverse String
- Leetcode 344 Reverse String
- [leetcode] 344. Reverse String 解题报告
- LeetCode 344. Reverse String 题解(C++)