Clear the String

Source: CF 1132F

  1. Read the problem and summarise the task requirements.
  2. Discuss why dynamic programming might be applicable to this problem.

  3. Propose a subproblem specification.
  4. Form a recurrence between your subproblems.

  5. Analyse the time complexity of your algorithm, and estimate the running time.
  6. Implement this algorithm in code.
  7. Submit your program for judging!