11 2014 档案

Tree Traversal
摘要:Basic Tree TraversalDepth First Traversal:1. In order traversal----left, root, right----4,2,5,1,32. Pre order traversal-----root, left, right-----1,2,... 阅读全文

posted @ 2014-11-27 07:25 SuperBo 阅读(127) 评论(0) 推荐(0)

Heli Track
摘要:Heli tracker. #1,2,3 as Gen Ace Battery. #4,5,6 as Nano Battery11/25/2014 Trex450 #1 Lightly crashed, servo arm brake. Too dark to see heli level.#... 阅读全文

posted @ 2014-11-26 10:50 SuperBo 阅读(136) 评论(0) 推荐(0)

2.2 Kth element linked list
摘要:ProblemImplement an algorithm to find the kth to last element of a singly linked list.Solution 1 public static ListNode findElement(ListNode head, int... 阅读全文

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

1.8 Is Rotation
摘要:Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is ... 阅读全文

posted @ 2014-11-21 14:07 SuperBo 阅读(176) 评论(0) 推荐(0)

1.7 Matrix Zero
摘要:Write an algorithm such that if an element in an MxN matrix is 0, itsentire rowand column are set to 0. 1 public static void matrixZero(int[][] matrix... 阅读全文

posted @ 2014-11-21 13:42 SuperBo 阅读(255) 评论(0) 推荐(0)

1.6 Image Rotation
摘要:Given an image represented by an NxN matrix, where each pixel in the image is4 bytes, write a method to rotate the image by 90 degrees. Can you do thi... 阅读全文

posted @ 2014-11-21 12:57 SuperBo 阅读(182) 评论(0) 推荐(0)

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 阅读(208) 评论(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 阅读(361) 评论(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)

Cipe Coding Summary Part2
摘要:25.Matrix PositionGiven an NxN matrix with unique integers :Find and print positions of all numbers such that it is the biggest in its row and also th... 阅读全文

posted @ 2014-11-19 05:40 SuperBo 阅读(593) 评论(0) 推荐(0)

Cipe Coding Summary Part1
摘要:1. Colorful Number:A numbercan be broken into different sub-sequence parts. Suppose a number 3245 can bebroken into parts like 3 2 4 5 32 24 45 324 24... 阅读全文

posted @ 2014-11-17 08:36 SuperBo 阅读(692) 评论(0) 推荐(0)

Java tricks & knowledge Summary
摘要:1. Get number of digits in an intvar length = (int)Math.Floor(Math.Log10(n) + 1);2. Keyword SuperUse super to refer superclass method if the method ha... 阅读全文

posted @ 2014-11-16 11:33 SuperBo 阅读(173) 评论(0) 推荐(0)

Epic OA Day2 2014/11/7
摘要:1. Count and SayThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11i... 阅读全文

posted @ 2014-11-08 01:31 SuperBo 阅读(269) 评论(0) 推荐(0)

LeetCode day15 2014/11/3
摘要:42. Add Two NumbersLinkList 必看题!dummyHead43. Add Binarycarry = a.charAt(p1) - '0';res = String.valueOf(carry%2) + res;44. Merge K Sorted Lists跳过45. Ro... 阅读全文

posted @ 2014-11-04 11:33 SuperBo 阅读(102) 评论(0) 推荐(0)

LeetCode day14 2014/11/2
摘要:36. Set Matrix ZerosConstant space solutionuse first row and first col as flag space which save the zeros row & col info. Store the first row & col o... 阅读全文

posted @ 2014-11-03 10:09 SuperBo 阅读(88) 评论(0) 推荐(0)

LeetCode day13
摘要:34. Search for a Range两遍binary search, 找到开始的Index和结束的Index36. Set Matrix ZerosO(m+n) is easy 阅读全文

posted @ 2014-11-01 00:37 SuperBo 阅读(93) 评论(0) 推荐(0)