leetcode-546-Remove Boxes
问题
Given several boxes with different colors represented by different positive numbers.
You may experience several rounds to remove boxes until there is no box left. Each time you can choose some continuous boxes with the same color (composed of k boxes, k >= 1), remove them and get k*k
points.
Find the maximum points you can get.
Example 1:
Input:
1 | [1, 3, 2, 2, 2, 3, 4, 3, 1] |
Output:
1 | 23 |
Explanation:
1 | [1, 3, 2, 2, 2, 3, 4, 3, 1] |
Note: The number of boxes n
would not exceed 100.
分析
代码
Author: Hatton.Liu
Link: http://hattonl.github.io/2020/03/23/leetcode-546/
License: 知识共享署名-非商业性使用 4.0 国际许可协议