Refresh to get another 5 random questions

100 statements

There are 100 statements, the $n$th statement says: among these 100 statement, at most $(n-1)$ are true. How many are true?


Measure 4 quarts of water

If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?

--
collected from http://www.softwareinterview.com/


k-th smallest element in the union of the two lists

You are given two sorted lists of size m and n. Give an O(log m+log n) time algorithm for computing
the kth smallest element in the union of the two ...


Two random points in [0,1]

Two i.i.d uniform random points x and y on the interval [0,1] result in three segments summing to 1.

(1) What is the expected length of the shortest ...


Determine if a number is a power of an integer

Describe an algorithm to find out if an integer is a square.