We will discuss and solve the problem https://codeforces.com/contest/1845/p...
We will discuss exponential complexity solution followed by O(N*M*M) solution followed by O(N*M) solution.
We will go over the
1. Problem statement
2. Sample input outputs
3. Brute force solution
4. Understanding the problem and breaking it into subproblems
5. DP definitions and recurrences
6. Reducing the complexity further
7. Code walkthrough
Please leave a like and subscribe to the channel for more videos.
A comment telling me that I helped you in someway, definitely makes my day :)
Code Submissions:
O(N*M) - https://codeforces.com/contest/1845/s...
O(N*M*M) - https://codeforces.com/contest/1845/s...