Why i am getting wrong answer in some of the test cases

I was solving dp educational contest of at coder problem F-LCS

My solution to the problem

You are never doing iā€“

while(i!=0&&j!=0)
        {
            if(s1[i-1]==s2[j-1])
            {
                res+=s1[i-1];  //res is string
                j--;
                i--;
            }
            else if(dp[i-1][j]==dp[i][j])
            i--;
            else
            j--;
        }
1 Like

but i m pushing char in stack
i think they are one of the same thing

okay i got it thank you so much @sebastian

Yeah I told that because I used string