BASE CASE EXPLANATION

can you explain the base case where you have taken dp(1,x) as 0 when x is not equal to v1

@Rishi-Raj-498676387415689,
That’s because there is only one possible way to include the very first item, right?

no no the infinity one

at 10:21 kartik bhaiya said it should be infinity

@Rishi-Raj-498676387415689,
Oh okay that is because, we store the minimum total weight, so we initialise the “non-reachable” base cases with infinity, so that they don’t interfere with the answer of further cases.
It’s similar to when you have to find the minimum from array, you initialise the min_var with infinity and then iterate over array to find the minimum.