摘要: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,...
阅读全文
摘要: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.#...
阅读全文
摘要:ProblemImplement an algorithm to find the kth to last element of a singly linked list.Solution 1 public static ListNode findElement(ListNode head, int...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:Problem电池有6节包装,9节包装,20节包装三种,input需要多少节电池,如果可以刚好用3种包装的凑到这个数,就输出这个解, 忘了是不是要输出所有的解。 e.g 输入20, 答{20} 输入17 答没有 输入18,那可能是{6,6,6}也可能是{9,9}。 有点像找钱的问题,似乎是从集合...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:ProblemGiven aNXN matrix, starting from the upper right corner of the matrix start printingvalues in a counter-clockwise fashion. E.g.: Consider N = 4...
阅读全文
摘要: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,...
阅读全文
摘要: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: "...
阅读全文
摘要:Problem感觉和上面的题又有点像, 给一个string, 里面不能有数字。 然后所有的大写字母和非字母符号不能动, 其他的小写字母可以随意动。 输出所有的可能。 e.g. input Oh my-god! output Om hd-goy! Oy hm-dog! 等等。。Soluti...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:ProblemYou know a password is well-ordered string. Well-ordered string means that the order of the characters is in an alphabetical increasing order. ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:42. Add Two NumbersLinkList 必看题!dummyHead43. Add Binarycarry = a.charAt(p1) - '0';res = String.valueOf(carry%2) + res;44. Merge K Sorted Lists跳过45. Ro...
阅读全文
摘要: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...
阅读全文
摘要:34. Search for a Range两遍binary search, 找到开始的Index和结束的Index36. Set Matrix ZerosO(m+n) is easy
阅读全文