wrote tests and corresponding code to solve the challenge