I am trying a dp solution but getting a weird runtime error. Please point out the bug. I have explained the code in comments.
submission link
`
Define Following Block outside main it will work Fine.
int inv[200][200]; //Stores possible inversions
int w[200000]; //Stores the word
int dp[200][200000];
1 Like
thanks dude for such a quick reply. really helpful community we have. btw can you explain why making those arrays local was creating problem? i m not so good in c/c++.