IXL Learning interview question

Hackerrank, 4 exercises