This is a silly, made up problem, which doesn't tell you much about a candidate, but let's ignore that :-)
It's also a very easy (but presumably tricky) problem, because it is completely self contained. For such problems, you can, and should, start with unit tests.
In Leo, here is the gist:
1. Create an @test node.
2. Within that node, create a table of inputs and expected outputs.
3. For each entry in the table, assert that the expected output matches the output of your code.
For a really simple problem like that, you can define the code in the @test node :-)
There are lots of unit tests like this in unitTest.leo.
HTH.
Edward