Skip to content

Instantly share code, notes, and snippets.

View charlespunk's full-sized avatar

charlespunk charlespunk

View GitHub Profile
Given an M*N matrix in which each row and each column is sorted in ascending order, write a method to find an element.
public static int findMaxDepth(Node root){
if(root == null) return -1;
return Math.max(fidMaxDepth(root.left), findMaxDepth(root.right)) + 1;
}
1. Make any given string a palindrome by adding the minimum number of characters.
http://isharemylearning.blogspot.com/2012/08/minimum-number-of-insertions-in-string.html
http://blog.csdn.net/atfield/article/details/1496132
http://blog.csdn.net/atfield/article/details/1496132
2. power of a number (hint: recursion)
3. Describe the file system in hadoop in big view
4. If you are writing a class in Java, "Student" for example; you are storing it in a hashtable; and you want the objects are identical to the names. what can you do?
command line:
run.exe cat "big dog" fish the"symbol monkey
return:
1. run.exe
2. cat
3. big dog
4. fish
5. the"symbol
6. monkey
Given a M*N matrix, if matrix[i][j] == 0, set all the elements in row i and column j to '0'.
When you could not use other buffer.
When this is a 3D matrix or nD matrix.
____ ____
| |___| |
|__|___|___|_
Several rectangles range along a line. Reruen the outline of rectangles.
Find the biggest sum of a sequent integers.
For example:
[4 3 -2 1 -8 10 2 -3 -1]
The giggest sequence is "10 2" => 12.
Given a sorted array of strings which is interepersed with empty strings, write a method to find the location of a given string.
Write a methos to sort an array of strings so that all the anagrams are next to each other.
You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted order.
1 5 8 9
2 6 8 10