Indigo interview question

There was a live coding exercise for a relatively simple problem