category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

Game Routes,

Code sample ```cpp int n, m; std::cin >> n >> m; std::vector graph[n + 1], revGraph[n + 1], inEdge(n + 1); for (int i = 0; i < m; i++) { int a, b; std::cin >> a >> b; graph[a].push_back(b); revGraph[b].push_back(a); inEdge[b]++; } std::queue qu; for (int i = 1; i <= n; i++) { if (inEdge[i] == 0) { qu.push(i); } } std::vector order, dp(n + 1, 0); while (!qu.empty()) { auto u = qu.front(); qu.pop(); order.push_back(u); for (const auto &v : graph[u]) { if (--inEdge[v] == 0) { qu.push(v); } } } dp[0] = dp[1] = 1; for (int i = 1; i < n; i++) { int u = order[i]; for (const auto &v : revGraph[u]) { dp[u] += dp[v]; dp[u] %= mod; } } std::cout << dp[n] << '\n'; ``` </details>