First, find all SCCs using Kosaraju or Tarjan. Compress the graph: each SCC becomes one node with total coins equal to the sum of all coins in that SCC. Build the condensation DAG with edges between components. Run DP on this DAG: dp[v] represents the maximum coins you can collect starting from component .
Base case: If component has no outgoing edges, dp[v] = coins[v]. Transition: dp[v] = coins[v] + max(dp[u]) for all edges in the condensation graph.