Help me understand the editorial for this DP question pls!

Правка en1, от _Siegefried, 2021-09-25 16:55:22

LINK to the problem

Its a previous edition "Codeagon" problem and I am trying to understand the editorial. I get the approach but it's my first time encountering a 4-D dp approach. I get the basic intuition behind the problem of subtracting solutions containing characters from only one string from all the solutions, but am unable to understand why we need a 4th state ("status" in editorial) at all as in calculating all possible solutions, how does it matter if I selected/skipped a character from A or from B previously, so why even keep a tab of it. I am probably looking at it wrong, so any help would mean a lot. Also, if a different approach comes to mind, pls do share it as well, thx!

Теги string, dynamic programming, codeagon

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский _Siegefried 2021-09-25 16:55:22 844 Initial revision (published)