546 Remove Boxes
546. Remove Boxes
1. Question
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 getk*k
points.
Find the maximum points you can get.
Example 1: Input: [1, 3, 2, 2, 2, 3, 4, 3, 1]
Output: 23
Explanation:
Note: The number of boxesn
would not exceed 100.
2. Implementation
(1) DP
3. Time & Space Complexity
Last updated