array hopperII
思路和I一样,也是从右向左. m[i] represents the min step needed to jump from i to length - 1; m[i] = 1 + min(m[j] where j > i, && j can be reached from i
by only one jump)
- Maximum Subarray
只要看m[i - 1]是否>= 0,if true, m[i] = m[i - 1] + array[i]
else m[i] = array[i]
记录一个global max
follow up: max subarray 的start 和end
需要记录四个变量, start, end, global_start, global_end
- word break
将dict 装入set
m[i] if m[j] && manully check set.contains(input.substring(j, i))
then m[i] is true and break