RBC interview question

Simple coding challenge.