Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Create an array storing all of the words in sentence separated.
Try dynamic programming.
Build a dp array where dp[i] represents the minimum total cost for the first i + 1 words.