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

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

I was trying to solve this problem on spoj that involves LCS with some other constraints. I have come with a recursive solution which gives correct answer on all cases. But when I try to memoziate it, it gives wrong answer. I am not able to figure out why it gives wrong answer on memoziation. my code is here with explanation.

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

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

With your recursive approach, you will need N*N*K memory to store everything which is a lot, the WA might be a RE due to not having enough space to allocate your arrays.