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 ...
随机推荐
- CentOS6.4 安装 mongo-connector
mongo-connector在python2.6.6版本下安装不成功,官方测试2.7,3.3正常 需要升级python2.7 具体步骤: 安装开发工具包: yum groupinstall &quo ...
- js常识
btnDelAll.Attributes.Add("onclick", "<script lunguage='javascript'>return windo ...
- [转载]mongoDB学习笔记——存取图片(C#)
作为一个NoSql数据库的代表,存取多媒体数据,应该是强项吧?那么,图片在mongoDB里是如何存取的呢?(其实,关系型数据库存取图片也一点问题没有,所以我看NoSql的强项不在于是否存储多媒体,而在 ...
- WP-Syntax 插件使用方法
技术博客中使用WP-Syntax将代码高亮是最常见的.而一段时间不用总会忘记每种语言的的pre标签的值. 这里简单介绍下,WP-Syntax 是一个针对 Wordpress 的代码高亮插件,最大的优点 ...
- Fiddler 日志
Fiddler 日志(Logging) 在开发扩展插件及编写FiddlerScript时对调试程序非常有用. 1.输出日志 在FiddlerScript脚本中,你可以这样输出输出日志: Fiddler ...
- How to Cope with Deadlocks
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html How to Cope with Deadlocks This section ...
- CF135A Replacement
http://codeforces.com/problemset/problem/135/A 题意 : 我能说我卡在这个题的题意上很久吗.....这个题就是在数组里找一个数,然后找另一个数把他替换掉, ...
- EOJ-1708//POJ3334
题意: 有一个连通器,由两个漏斗组成(关于漏斗的描述见描述). 现向漏斗中注入一定量的水,问最终水的绝对位置(即y轴坐标) 思路: 总体来说分为3种情况. 1.两个漏斗可能同时装有水. 2.只可能a漏 ...
- 多线程 (五)NSOperation
NSOperation是对GCD的分装,OC语言,更简单方便 NSOperation和NSOperationQueue一起使用也能实现多线程编程 基本步骤: 将操作封装到一个NSOperation对象 ...
- Android 解析XML
public void getXML(String url) throws XmlPullParserException,IOException,URISyntaxException { String ...