Plenty of well known algorithms find the shortest route from one place to another. The GPS units in cars and phones tell you the fastest way to reach your destination. On vacation, though, Troy likes to travel slowly. He wants to see many new and interesting places on the way, so he takes the longest route to his destination.
A route is a sequence of distinct cities c1,c2,…,ck such that for every 1≤i<k there is a road from ci to ci+1. Troy never visits the same city twice.
Find the length of the longest route.