Print the numbers between 30 to 3000.
Microsoft Interview Question Developer Program Engineers
看到一个题目比较有意思:
Print the numbers between 30 to 3000.
CONSTRAINT:
The numbers shouldnt contain digits either in incresing order or decreasing order.
FOLLOWING NOT ALLOWED
##123,234,345,1234,2345##increasing order,
##32,21,321,432,3210 etc##decresing order.
FOLLOWING ALLOWED:
243,27,578,2344 etc.,
Now see who ll code ths....
-
答案是:
String sortedNumbers = "123456789 9876543210";
for (int i = 31; i <= 3000; i++) {
String temp = "" + i;
if (!sortedNumbers.contains(temp)) {
System.out.println(temp);
}
}
Print the numbers between 30 to 3000.的更多相关文章
- PAT A1127 ZigZagging on a Tree (30 分)——二叉树,建树,层序遍历
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can ...
- 1127 ZigZagging on a Tree (30 分)
1127 ZigZagging on a Tree (30 分) Suppose that all the keys in a binary tree are distinct positive in ...
- PAT甲级 1127. ZigZagging on a Tree (30)
1127. ZigZagging on a Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- [图的遍历&多标准] 1087. All Roads Lead to Rome (30)
1087. All Roads Lead to Rome (30) Indeed there are many different tourist routes from our city to Ro ...
- [并查集] 1107. Social Clusters (30)
1107. Social Clusters (30) When register on a social network, you are always asked to specify your h ...
- PAT A1127 ZigZagging on a Tree (30 分)
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can ...
- pat1087. All Roads Lead to Rome (30)
1087. All Roads Lead to Rome (30) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- pat 甲级 1127. ZigZagging on a Tree (30)
1127. ZigZagging on a Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- PAT-1107 Social Clusters (30 分) 并查集模板
1107 Social Clusters (30 分) When register on a social network, you are always asked to specify your ...
随机推荐
- Unity3d读取.csv文件
原文地址:http://blog.csdn.net/dingkun520wy/article/details/26594991 (一)文件路径 需要把csv文件放在StreamingAssets这个文 ...
- python多进程中的队列数据共享问题
0x00 起 今天在写一个小东西的时候,需要控制并发量,但又不能直接调用python multiprocessing(问题会在文后提到).于是尝试用Queue来实现. 最一开始的思路是这样的: fro ...
- python学习笔记16(错误、异常)
一.什么是错误,什么是异常 错误是指在执行代码过程中发生的事件,它中断或干扰代码的正常流程并创建异常对象.当错误中断流程时,该程序将尝试寻找异常处理程序(一段告诉程序如何对错误做出响应的代码),以帮助 ...
- php实现调用微信上传照片然后保存至服务器与数据库
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <s ...
- spring dataSourceRouter自动切换数据源
spring多数据源的切换,主要用到的是AbstractRoutingDataSource这个路由类,当我们的自定义的一个路由分发类继承AbstractRoutingDataSource类后,重写de ...
- 解决Cisco VPN Client:Reason 442: Failed to Enable Virtual Adapter VPN连接问题
大公司里肯定涉及不同地点的办公问题,这样VPN的使用就频繁了,今天遇到一个VPN连接问题,分享给大家,看一眼,以后不在这问题上耗费太多功夫. 在win7上连接vpn时抛出“failed to enab ...
- E437: terminal capability "cm" required
执行 vi 的时候出现:E437: terminal capability "cm" required 临时解决: export TERM=xterm
- ExtJS4.2学习(二)Ext统一组件模型——Panel
鸣谢:http://www.shuyangyang.com.cn/jishuliangongfang/qianduanjishu/2013-11-06/171.html --------------- ...
- win8系统中PL/SQL Developer连接Oracle出现的问题
注意:所有软件最后不要安装在program files (x86)下 PL/SQL Developer显示Not logged on 以管理员的身份打开PL/SQL Developer 2. t ...
- Linux---Ls命令 初级实现
By xxx0624Done: ls ls -a ls -l ls /tmp ls -R ls -t FileName color FileName o ...