code: https://ide.codingblocks.com/s/422301
prob: https://leetcode.com/problems/longest-common-subsequence/
giving some error although logic seems correct
code: https://ide.codingblocks.com/s/422301
prob: https://leetcode.com/problems/longest-common-subsequence/
giving some error although logic seems correct
code and logic are correct
only thing you have to change is size of dp array
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
as you are using 1 base indexing so make size of array (n+1)X(m+1)
Modified Code
oh okay thanks I get confused with indices sometimes
if doubt is resolved plz mark it as resolved from your side
or i share you the link to resolve the doubt