Jump Trading Interview Question

Graph theory problem. LC hard.