Bloomberg interview question

TDD implement with problem statement.