Need help to solve "Toph — Very Dirty String"

Revision en1, by I__Love__TANIA, 2018-08-07 21:35:01

Need some help to solve Very Dirty String problem.

Short Description:

Given three strings A, B and C. Find the longest common sub-sequence of A and B, which have C at-least once as a substring in it.

Input: There will be T test cases. For each test there will be three lines describing string A, B, and C.

Constraints: 1 ≤ T ≤ 100 1 ≤ |A|, |B|, |C| ≤ 100

My approach: I tried it using normal recursive LCS with extra another state pointing the index of string C i'm trying to match.

here is my code.

Sorry for my bad English.

Tags #dp, #dynamic-programming, #strings, #lcs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English I__Love__TANIA 2018-08-07 21:35:01 665 Initial revision (published)