Gelato interview question

Hacker rank challenges HR interview