• + 2 comments

    Same here. I have two problems about the editorial solution: 1) what is the "obvious" reason for coming up with dp[alpha][beta][theta] from dp[alpha][beta][gamma] ? 2) how is the recursion for dp[alpha][beta][theta] deducted? I tried multiple approach but could not arrive at the same recursion.

    And the code itself is even more cryptic, it took me hours to figure out "how" it works but I still don't understand "why" it works.