FortifyIQ interview question

There was an abstract algorithmic task with ghost