Pocket Gems interview question

OA: Lytmus challenge(two IO,easy algorithm questions)