Microsoft interview question

coding an iterator by yourself