Yahoo interview question

Basic Algorithm Question