Peloton Interactive interview question

Hacker rank coding challenge