category-wise-problems

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

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

D - FG Operation, Dynamic programming, Coin change type

Approach.

Implementation ```cpp ll n; cin >> n; vector arr(n); for (ll i = 0; i < n; i++) cin >> arr[i]; ll dp[n + 1][10]; memset(dp, 0, sizeof(dp)); dp[1][arr[0]] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j < 10; j++) { dp[i][(j + arr[i - 1]) % 10] += dp[i - 1][j]; dp[i][(j * arr[i - 1]) % 10] += dp[i - 1][j]; dp[i][(j + arr[i - 1]) % 10] %= mod; dp[i][(j * arr[i - 1]) % 10] %= mod; } } for (int j = 0; j < 10; j++) { cout << dp[n][j] << '\n'; } cout << '\n'; ``` </details>