Battery (Coin Change)

摘要: Problem电池有6节包装,9节包装,20节包装三种,input需要多少节电池,如果可以刚好用3种包装的凑到这个数,就输出这个解, 忘了是不是要输出所有的解。 e.g 输入20, 答{20} 输入17 答没有 输入18,那可能是{6,6,6}也可能是{9,9}。 有点像找钱的问题,似乎是从集合... 阅读全文
posted @ 2014-11-21 10:08 SuperBo 阅读(203) 评论(0) 推荐(0) 编辑

Count And Say

摘要: ProblemImplement Count And Say function. For example, first, let user input a number, say 1. Then, the function will generate the next 10 numbers whic... 阅读全文
posted @ 2014-11-21 09:58 SuperBo 阅读(173) 评论(0) 推荐(0) 编辑

Colorful Number

摘要: ProblemA number can be broken into different sub-sequence parts. Suppose, a number 3245 can be broken into parts like 3 2 4 5 32 24 45 324 245. And th... 阅读全文
posted @ 2014-11-21 09:55 SuperBo 阅读(224) 评论(0) 推荐(0) 编辑

Spiral Matrix

摘要: ProblemGiven aNXN matrix, starting from the upper right corner of the matrix start printingvalues in a counter-clockwise fashion. E.g.: Consider N = 4... 阅读全文
posted @ 2014-11-21 09:53 SuperBo 阅读(183) 评论(0) 推荐(0) 编辑

Stepping Number

摘要: ProblemA number is called as a stepping number if the adjacent digits are having a difference of 1. For eg. 8,343,545 are stepping numbers. While 890,... 阅读全文
posted @ 2014-11-21 09:50 SuperBo 阅读(474) 评论(0) 推荐(0) 编辑

Replace String

摘要: ProblemFrom a given string, replace all instances of 'a' with 'one' and 'A' with 'ONE'.Example Input: " A boy is playing in a garden"Example Output: "... 阅读全文
posted @ 2014-11-21 09:45 SuperBo 阅读(348) 评论(0) 推荐(0) 编辑

String Permutation

摘要: Problem感觉和上面的题又有点像, 给一个string, 里面不能有数字。 然后所有的大写字母和非字母符号不能动, 其他的小写字母可以随意动。 输出所有的可能。 e.g. input Oh my-god! output Om hd-goy! Oy hm-dog! 等等。。Soluti... 阅读全文
posted @ 2014-11-21 09:39 SuperBo 阅读(134) 评论(0) 推荐(0) 编辑

Clock Angle

摘要: ProblemWe are given a specific time(like 02:23), we need to get the angle between hour and minute(less than 180)Solution 1 public static double clockA... 阅读全文
posted @ 2014-11-21 09:33 SuperBo 阅读(261) 评论(0) 推荐(0) 编辑

Keypad Permutation

摘要: ProblemPhone has letters on the number keys. for example, number 2 has ABC on it, number 3 has DEF, 4 number has GHI,... , and number 9 has WXYZ. Writ... 阅读全文
posted @ 2014-11-21 09:30 SuperBo 阅读(164) 评论(0) 推荐(0) 编辑

Replace Words

摘要: ProblemGiven a string. Replace the words whose length>=4 and is even, with a space between the two equal halves of the word. Consideronly alphabets fo... 阅读全文
posted @ 2014-11-21 09:23 SuperBo 阅读(214) 评论(0) 推荐(0) 编辑