Longest Path Solution. TODO: Test it!