经典背包问题 假设有n个物品,一个容量为C的背包,每个物品有相应的价值,怎么实现价值最大? 用递归实现: int[][] memo = new int[n][n];
int bestValue(int[] w, int[] v, int index, int c){if(index < 0 || c <= 0) return
首先来个热身的例子: 力扣总结:总结公式 这个一开始我以为就是个单纯的贪心问题,结果按照贪心的思路去做,果然wr了,提交错误。。。。。 class Solution {public int findMaxForm(String[] strs, int m, int n) {Arrays.sort(strs, new Com