Pocket Gems interview question

Implement indexAt() from scratch and give the run time