So, I suppose my initial thought to create a giant switch statement is not the answer they are looking for?
Don’t worry about the code at this point. Think and write out an algorithm (in plain language) which outlines the steps needed to accomplish the task. Then test out your algorithm steps by walking through each of the test cases to see if your algorithm will work. Once you are satisfied it will work, then worry about the applicable code to write.