标签:style blog http color java strong io for
题目:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue
",
return "blue is sky the
".
题解:
一个用了java的s.split(" "),按空格分隔。
然后调用了系统函数:Collections.reverse(list);把list顺序调换了。
最后再把结果存成数组即可。
代码如下:
Reverse Words in a String leetcode java,布布扣,bubuko.com
Reverse Words in a String leetcode java
标签:style blog http color java strong io for
原文地址:http://www.cnblogs.com/springfor/p/3888029.html