• function or class?

Question related to mission Solution for Anything

 

it is possible to solve this without class? if no - looks like definition of task is wrong.