Skip to content

Instantly share code, notes, and snippets.

View charlespunk's full-sized avatar

charlespunk charlespunk

View GitHub Profile
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?
public static int findMaxDepth(Node root){
if(root == null) return -1;
return Math.max(fidMaxDepth(root.left), findMaxDepth(root.right)) + 1;
}
Given an M*N matrix in which each row and each column is sorted in ascending order, write a method to find an element.
Imagine you are reading in a stream of integers. Periodically, you wish to be able to look up the rank of a number x (the number of values less than or equal to x).implement the data structure and algorithms to support these operations. That is, implement the method track(int x), which is called when each number is generated, and the method getRankOfNumber(int x), which returns the number of values less than or eauql to x (not including x itself).
Write a function to swap a number in place (that is, without temporary variables).
Design an algorithm to figure out if someone has won a game of tic-tac-toe for N*N.
Write a method which finds the maximum of two numbers. You should not use if-else or any other comparision operator.
The game of Master Mind.
https://www.spotify.com/us/jobs/tech/
Given a array of integers, write a method to find indices m and n such that if you sorted elements m through n, the entire array would be sorted. Minimize n-m (that is, find the smallest such sequence).