PLease help in this question [problem:1932F] according to me my method is completely correct [submission:252346495]↵
UPD: I have checked bottom-up dp and it works! But the top-down dp as in the above one does not! Can someone give me an explanation? And also how to decide which one to choose.
UPD: I have checked bottom-up dp and it works! But the top-down dp as in the above one does not! Can someone give me an explanation? And also how to decide which one to choose.