CodeNation Hiring test

I came across this Link problem from codenation hiring test.
But couldnt seem to wrap my head around a solution.
I also came across a paper Paper for the same problem.

I wanted to know how to solve this problem.
Some pseudo code would surely help.