-3

I am not able to prove the optimal substructure and overlapping subproblem property for the problem in the link. The exact problem with me is that even after understanding standard problems of dp , i face problem in approaching the newer problems. Sometimes i can't find the subproblems of the solutions and sometimes i cannot prove the correctness of my approach to the problem. :

suraj bora
  • 61
  • 1
  • 11
  • 2
    So what is your question exactly? Do you need to find subproblems for a dynamic programming solution or do you already know it and need a proof of its correctness? – kraskevich Jan 03 '15 at 10:02
  • suraj please show us some effort, also please specify your problem, this kind of questions will not get answer, because first of all we dont know what is the exact question to answer, and beside that, we dont want to answer a question when OP show no interest of doing anything and think of us as free freelancers how will do your work for free :) – Lrrr Jan 03 '15 at 10:58

1 Answers1

0

Consider that the total you have once you get to brick number n will not influence your strategy; in other words the optimal path from there is independent on how you got there (the final score depends on it because depends on your current score, but the optimal path doesn't: you just need to grab as much as you can from now on anyway).

Also given that your opponent is going to take as much as possible too the formula simply becomes:

best of
    worst of
        me taking 1 and opponent taking 1
        me taking 1 and opponent taking 2
        me taking 1 and opponent taking 3
    worst of
        me taking 2 and opponent taking 1
        me taking 2 and opponent taking 2
        me taking 2 and opponent taking 3
    worst of
        me taking 3 and opponent taking 1
        me taking 3 and opponent taking 2
        me taking 3 and opponent taking 3

so there are 9 possibilities to check and each one will be a game with strictly fewer bricks that can be solved independently (this is the key point for being able to use a dynamic programming approach) for the reason stated above.

6502
  • 112,025
  • 15
  • 165
  • 265