Print_Longest_Common_Subseq


why my code is giving wrong answers.

Raju, I have edited your code a little bit, try to submit now, if you didnt understood anything, you can ask…

Mam, it is submitted correctly can you please suggest , my mistakes in my code.

Raju, in your code, instead of using string, I have used character array and calculated the length as per strlen function, then I havent used the different loops as you have used from line no 9 to line no 14, separately for rows and columns, instead, I have clubed those conditions together by starting loop from 0 onwards instead of 1, and then instead of using character vector, I have used a character array and just try to understand the printing logic I have used… It is somewht different from the one you have used… Rest code was alright… If u still didnt understood the changes in the code, You can ask me…

Mam i understand your code. But why, i can’t use string class instead of char array if input doesn’t have any space.And also at the output part i am just storing the characters in vector and then print in reverse manner.

You can use string and vector as well, but the approach needs to be similar only for test cases to pass… You can try using both in your code…