Friday, June 22, 2012

Complete the sequence

Find the next element in the sequence:
10 11 12 13 14 20 22 ... (Without using the polynomial-method)

Courtesy: QED 2012

Thursday, June 21, 2012

The even fibonacci

Prove that F[2n] cannot be of the form 4k+2, where F[i] is ith Fibonacci number. (F[0] = 0, F[1] = 1 etc...)

Wednesday, June 20, 2012

Value of selection

There is a 2 dimensional matrix M ( mxn ) of non-negative integers. A "selection" is defined as set of elements, satisfying the following condition:
If m>n then there is exactly one element from each column. Else, there is exactly one element from each row.
And sum of all elements of a selection is called its "value".
Find the selection with maximum "value" in O(m*n).

Monday, June 11, 2012

Second largest element in an array

Given an unsorted array of size n, find the second largest element of the array in "n + log(n)" steps.
( Its not O(n+log(n)), its "n + log(n)" ).

Courtesy : Career cup.