1. Given an int array A and a number x, partition the array into two parts so that the left part contains numbers that are not greater than x and the right part contains numbers that are greater than x. Your method should not use space that is proportional to the length of the array (you have to do the partition in place). Your function should partition the array and return the boundary point between the two parts.

2. Inverse a sentence. For instance, the input is "It is snowing", the output will be "snowing is It".

3. Spirally print a 2D array. For example, given a 2D array [1,2;3,4;5,6], your printout should be 1 2 4 6 5 3.

4. Print all the sequences of valid ( and ) of length n. Each ( needs a ) on its right. So (())() is valid but ())()( is not. Apparently n has to be a even number.

5. Given an integer array A and a number s, write a function to decide whether s can be represented as the summation of some elements in A. Each element can only be used once.

6. Implement int strstr(String s1, String s2), which returns the first position where s2 appears in s1.

7. Generate n-bit Gray code. Google what Gray code is.

8. Write a function to give a random subset of size K from a set with N numbers.

9. Given a 2D array in which each element is 0 or 1. Each element is connected to its neighors (up, down, left and right) with the same values, if there is one. Write a program to test whether you can start from one 1 element and reach the other one in the array.