Xeratic interview question

We were given a case and needs to code