Mindojo interview question

Basic backend questions, an easy algorithmic task