IBM interview question

assessment; coding challenge on hackerrank