Synthesis interview question

I was asked to code a solution for a simple made up scenario.