algorithm - Changing letters of a string to obtain maximum score -
You are given a string and can change the maximum number of characters in the string. You have also been given a list of substrings (two characters long), with a corresponding score. Each opportunity of the object within the string adds to your total score. What is the maximum possible receipt score? string length & lt; = 150, Q & lt; = 100, the number of substrings & lt; = 700 Example: string = BPDCG Q = 2 Substring: Bez - Score: 2 zd - Score: 5 DM - Score: 7 NG - Score: 10 This example In, you can get the maximum score by changing the "p" in the string, with a "z" and "c" with "n" on this, your new string is "bzdng", in which 2 + 5 + 10 = 17 Score is. I know that a string has been given that the letters have already been changed, the score may be a dictionary matching algorithm such as eh-coarsic (or slightly wrong complexity, rabin Carp) was checked in linear time. However, it will take a lot ...