leetCode题解
2016-03-10 20:48
274 查看
leetcode题解
(1)题目:
Given an input string, reverse the string word by word.
For example,
Given s = “the sky is blue”,
return “blue is sky the”.
使用java实现代码:
package leetcode;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class onecode {
public static void main(String[] args) throws IOException
{
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
System.out.print(“请输入一个字符串:”);
String str = strin.readLine();
String array[]=str.split(” “);
String printout=”“;
for(String item:array)
{
printout=item+” “+printout;
}
System.out.println(printout);
}
}
(1)题目:
Given an input string, reverse the string word by word.
For example,
Given s = “the sky is blue”,
return “blue is sky the”.
使用java实现代码:
package leetcode;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class onecode {
public static void main(String[] args) throws IOException
{
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
System.out.print(“请输入一个字符串:”);
String str = strin.readLine();
String array[]=str.split(” “);
String printout=”“;
for(String item:array)
{
printout=item+” “+printout;
}
System.out.println(printout);
}
}
相关文章推荐
- 如何查看eclipse是32位还是64位
- 图书数据库网址
- php curl vs python提交多维数组+文件
- 行者无疆
- YTU:C语言习题 矩形法求定积分
- java堆压测
- JAVA gc垃圾回收机制
- 传数组和传值的不同之处
- CUDA编程指南阅读笔记
- Windows 下的 Makefile 编写
- 在线doc或书籍(待续)
- Python 拷贝对象(深拷贝deepcopy与浅拷贝copy)
- Linux 字符设备驱动结构(二)—— 自动创建设备节点
- 通过一个例子快速上手矩阵求导
- 一个故事
- Java工程师成神之路
- 忘记Oracle系统管理员sys的密码
- 浏览器兼容性问题,主要针对IE6~7
- 事务传播行为 隔离级别
- Git、GitHub、SVN