随笔分类 -  Cipe

OA
Snake Sequence
摘要:ProblemYou are given a grid of numbers. A snake sequence ismade up of adjacent numbers such that for each number,the number on the right or the number... 阅读全文

posted @ 2014-11-21 10:10 SuperBo 阅读(311) 评论(0) 推荐(0)

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 阅读(207) 评论(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 阅读(181) 评论(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 阅读(231) 评论(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 阅读(197) 评论(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 阅读(498) 评论(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 阅读(360) 评论(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 阅读(142) 评论(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 阅读(269) 评论(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 阅读(174) 评论(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 阅读(222) 评论(0) 推荐(0)

Tic Tac Toe
摘要:ProblemN*N matrix is given with input red or black.You can move horizontally, vertically or diagonally. If 3 consecutive samecolor found, that color w... 阅读全文

posted @ 2014-11-21 05:47 SuperBo 阅读(268) 评论(0) 推荐(0)

Valid Password
摘要:ProblemIn 1-9 keypad one key is not working. If someone enters a password then not working key will not be entered. You have given expected password a... 阅读全文

posted @ 2014-11-21 05:41 SuperBo 阅读(681) 评论(0) 推荐(0)

Well-ordered String
摘要:ProblemYou know a password is well-ordered string. Well-ordered string means that the order of the characters is in an alphabetical increasing order. ... 阅读全文

posted @ 2014-11-21 05:28 SuperBo 阅读(650) 评论(0) 推荐(0)

Telephone Number
摘要:ProblemPrint all valid phone numbers of length n subject to following constraints:If a number contains a 4, it should start with 4No two consecutive d... 阅读全文

posted @ 2014-11-21 04:54 SuperBo 阅读(314) 评论(0) 推荐(0)