one of the test cases is failing pls help
my code
π‘ Optimal Game Strategy-I
hi pritika
no if-else comparison is required
you have to calculate both the optimal answers and then find the maximum out of the two.
F(i, j) represents the maximum value the user can collect from
iβth coin to jβth coin.
F(i, j) = Max(Vi + min(F(i+2, j), F(i+1, j-1) ),
Vj + min(F(i+1, j-1), F(i, j-2) ))
Base Cases
F(i, j) = Vi If j == i
F(i, j) = max(Vi, Vj) If j == i+1
1 Like