Wednesday, March 26, 2008

[blog] interview questions

1. Given a sequence Q of n numbers (positive and negative), the maximum subsequence of Q is the contiguous subsequence that has the maximum sum among all contiguous subsequences of Q.
2. Given an array of n integers (positive and negative), find a pair of integers in the array that equates to a k value.
3. Given an array of n integers (positive and negative), find the k largest integers in the array.
4. Given a link list of n elements. The list will always contain 1,000,000+ elements. Find the 100,000 element from the end of the array.
5. Given a link list of n elements. These elements can point anywhere and may even point back to a prior element in the list. This is when you have a cycle. Write a routine to detect cycles in this link list.
6. Given n marbles all of equal weight except 1 and two scales, find an algorithm to find the heaviest marble.
7. Stack (push, pop, peek); minPeek (push, pop, peek, peekMin)
8. Write a routine to get the fibonacci of n both recursively and with a loop.

No comments: