IBM interview question

1st code - based on array rotation