C#C
C#3y ago
popcorn

❔ Dynamic programming

Hello, I have a task, where I need to find the least keystrokes required to print a word.
I have a table sized X*Y filled with letters that can repeat
and I have a string
s
that can contain letters which are not in the table and should be skipped.

We cannot move diagonally in the table.
We always start at the left top corner.

How do I solve this using dynamic programming?
I have created a Dict where each letter gets List of positions it is in the table. But then I don't know how to look ahead.

Let's say we have table:
ABC  
BFE  
CDF

and string = ABCDEFA

Then when choosing F from E, how do I choose the middle one because it is closer to the next character (A) and not the right lower F
Was this page helpful?