Kalepa interview question

Easy - medium algorithmic coding question