I__Love__TANIA's blog

By I__Love__TANIA, history, 6 months ago, In English,

I need help to solve SPOJ — BUILDING

I can solve it in O( total h_i * 2 * log(m) ). But it is not enough to get Accepted.

How can i optimize complexity?

Read more »

 
 
 
 
  • Vote: I like it  
  • +1
  • Vote: I do not like it  

By I__Love__TANIA, history, 7 months ago, In English,

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.

Read more »

 
 
 
 
  • Vote: I like it  
  • -2
  • Vote: I do not like it