Блог пользователя javacoder1

Автор javacoder1, история, 9 лет назад, По-английски

I am unable to solve the question https://www.hackerrank.com/contests/codeagon/challenges/jesse-and-two-strings-

The editorial is clear to me upto the point where i encounter the following statement After finding the LPS for the both the strings, we traverse through L(i,i)=Length of LPS,∀i=0...N−1 and see what all the middle characters can both the LPS's have. Can someone explain me this? Thanks.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Ok someone who participated in contest, Please provide their submission because the submissions are not visible.

»
9 лет назад, # |
Rev. 4   Проголосовать: нравится +4 Проголосовать: не нравится

http://ideone.com/C54QLn if len1 and len2 are odd then:-

after finding Lps Just traverse through the strings and mark the characters that can be used as a centre in odd length palindrome. if both strings have a common character that can be used as a centre in both then ans is len1+len2 else len1+len2-1. for more details refer code.

else:- the ans is len1+len2 always.