interview problem from Amazon