[Question Link](https://codeforces.me/contest/166/problem/E)↵
In this problem, I initially implemented a DP solution by defining the state and transition. However, it resulted in a "Memory Limit Exceeded" error. ↵
Surprisingly, when I simply interchanged the row and column while keeping the logic, states, and transitions the same, the solution was accepted.↵
↵
Can someone explain why this happened?↵
↵
You can see the [Accepted Submission: [submission:](https://codeforces.me/contest/166/submission/311383136])↵
↵
[Memory Limit Exceeded: [s Submission:](https://codeforces.me/contest/166/submission/311381200])
In this problem, I initially implemented a DP solution by defining the state and transition. However, it resulted in a "Memory Limit Exceeded" error. ↵
Surprisingly, when I simply interchanged the row and column while keeping the logic, states, and transitions the same, the solution was accepted.↵
↵
Can someone explain why this happened?↵
↵
You can see the [Accepted Submission
↵
[Memory Limit Exceeded