Trulia Interview Question

Very simple algorithm question