Longest common subsequence

please help me with the code


added comments and fixed the mistake, hope this helps
if your doubt is solved, please mark it as resolved

it is not giving the correct output


that was because, it was printing it in reverse order, you have to save it in a vector and then iterate the vector backwards

this passes all the cases on hackerblocks as well
if your doubt is solved. please mark it as resolved