class Solution {
public int pileBox(int[][] box) {
int n = box.length;
Arrays.sort(box,(a,b) -> a[0] - b[0]);
int[] f = new int[n];
int res = 0;
for ( int i = 0;i < n;i++){
for (int j = i - 1;j >= 0;j--){
if ( box[i][0] > box[j][0] && box[i][1] > box[j][1] && box[i][2] > box[j][2]){
f[i] = Math.max(f[j] + box[i][2],f[i]);
}
}
if ( f[i] == 0){
f[i] = box[i][2];
}
res = Math.max(f[i],res);
}
return res;
}
}
09-12
413
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交