This is a "strongly connected components" questions. The islands are the vertices. The zip lines are directed edges. First, find all of the strongly connected components (and the size of each).