TeleTracking interview question

how I would improve my solution