Trulia interview question

Very simple algorithm question