Rocksbox interview question

Very reasonable and practical coding problem.