In counting towers solution you have written dp[i][p] is Number of ways to fill from ith position till nth position But I think what you mean is number of ways to fill from 0th position to ith position → Reply
✔ Counting Towers Code ✔ Edit Distance Code ✔ Rectangle Cutting Code ✔ Money Sums Code ✔ Removal Game Code ✔ Two Sets II Knapsack DP Code ✔ Increasing Subsequence LIS Code ✔ Projects Code Elevator Rides Code ✔ Counting Tilings Broken Profile DP Bitmask Code ✔ Counting ...
UPD2new video: I just uploaded avideo solutionto Multiplication Table from CSES. If you want to suggest more videos, be ready to do it in comments, I want to upload as many solutions as possible. In addition, any feedback is much appreciated as well. Hereis a playlist where you can w...
Counting Towers (2413) Link to Task We define our dp state as dp[h] = the number of possible towers of height h. We now look at the possible solutions for towers of heights 1 and 2 to understand how to transition between the states of our dynamic programming. The 2 possible solutions...
i found this useful: youtube video solution → Reply » Karansoni158 4 years ago, hide # | 0 Code for new problem counting towers. long long dp[10000005][2] int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int test_case = 1; cin >> tes...