educative.io

What are the correct start points and index, 0 or 1?

This is the similar problem compare to staircase.

In staircase problem, the start point is stair 0, then we can take step1, 2, 3 to reach stair 1, 2, 3.

In this problem, from the Problem Statement example1, 2, I think the problem assumes we start from index 0 which is stair 1.

So my question is what are the correct start points and index for both problems?

And what is the definition of the top in both problems? the last stair or the one above the last one stair?

I was SO confused by the both problems. And that affects my understanding of the solutions.

Does anyone have any ideas? Thank you!

Actually, it is a bit confusing when one starts with it.

In both the cases, think like this - you always start at the first step, and the topmost step always refers to what exists after final step.

Go through the bottom up DP solution once again with this in mind :slight_smile: