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.的更多相关文章

  1. 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 ...

  2. 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 ...

  3. PAT甲级 1127. ZigZagging on a Tree (30)

    1127. ZigZagging on a Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  4. [图的遍历&多标准] 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 ...

  5. [并查集] 1107. Social Clusters (30)

    1107. Social Clusters (30) When register on a social network, you are always asked to specify your h ...

  6. 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 ...

  7. pat1087. All Roads Lead to Rome (30)

    1087. All Roads Lead to Rome (30) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  8. pat 甲级 1127. ZigZagging on a Tree (30)

    1127. ZigZagging on a Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  9. PAT-1107 Social Clusters (30 分) 并查集模板

    1107 Social Clusters (30 分) When register on a social network, you are always asked to specify your ...

随机推荐

  1. 获取网页上数据(图片、文字、视频)-b

    Demo地址:http://download.csdn.net/detail/u012881779/8831835 获取网页上所有图片.获取所有html.获取网页title.获取网页内容文字... . ...

  2. 简单3d RPG游戏 之 005 选择敌人

    选择一个敌人,按ctrl+d,复制出3个,调整一下它们的位置,不重叠,修改Tag为Enemy,禁用EnemyAI. 创建Targetting脚本,绑定到Player玩家对象 public class ...

  3. NSFileHandle 和 NSFileManager的一些用法

    文件操作 NSFileManager 常见的NSFileManager文件的方法: -(BOOL)contentsAtPath:path 从文件中读取数据 -(BOOL)createFileAtPat ...

  4. 扫盲Linq知识

    LINQ,语言集成查询(Language Integrated Query),是在.NET Framework 3.5 中出现的技术. 借助于LINQ技术,我们可以使用一种类似SQL的语法来查询任何形 ...

  5. 引用外部CSS的link和import方式的分析与比较

    很多网页中的 CSS 链接与引用是这样写的: <style type="text/css" media="screen"> @import url( ...

  6. UNITY3D使用NGUI制作自适应UI的总结

    原地址:http://www.cnitblog.com/updraft/archive/2013/11/12/88801.html 制作自适应的几个方法1. 使用 UIROOT 里设置自定义高度的方法 ...

  7. 1046-第K回文数

    描述 回文数是这样一个正整数:它从左往右读和从右往左读是一样的.例如1,111,121,505都是回文数.将1到100,000,000内所有回文数按从小到达排序后,第k个回文数是多少呢? 输入 第一行 ...

  8. 关于jsp页面是放在webroot目录下和web-inf下优缺点

    CSDN问题: jsp放在webroot目录下 这样就可以让用户直接访问,jsp放在web-inf目录下就必须要通过请求才能访问.因此放在web-inf下jsp页面显得要安全. 既然这样 ,那是不是只 ...

  9. POJ1002487-3279(map)

    http://poj.org/problem?id=1002 题意:是说很多公司用了容易记住的电话号码,例如有英文字母的或者是用了很多连字符或没有连字符的.每个电话号码都有标准模式,而为了统计有没有重 ...

  10. 6大排序算法,c#实现

    using System; using System.Text; using System.Collections.Generic; namespace ArithmeticPractice { st ...