RWS Group Interview Question

A short but interesting programming challenge, combining basic coding skills and logical / mathematical thinking. I was given one week to solve it, took just an hour or two. Though my solution wasn't exactly the best possible one, I was still invited to an interview where I explained it along with my thinking behind it.