Steps for solving DP problem:
- Define subproblems
- Write down the recurrence that relates subproblems
- Recognize and solve the base cases
In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. Each subarray will be of size
k, and we want to maximize the sum of all
A message containing letters from A-Z is being encoded to numbers using the following mapping:
A -> 1
B -> 2
Z -> 26
Given a non-empty string containing only digits, determine the total number of ways to decode it.
Beyond the description above, the encoded string can also contain the character ‘*‘, which can be treated as one of the numbers from 1 to 9.
* -> 1, 2, ..., 9