摘要:
问题描述 给你一个装载重量为 W 的背包和 N 个物品,每个物品有重量和价值两个属性。其中第 i 个物品的重量为 \(wt[i]\),价值为 \(val[i]\),现在让你用这个背包装物品,最多能装的价值是多少? 示例 N = 3, W = 4 wt = [2, 1, 3] val = [4, 2, 阅读全文
摘要:
二位列表去重 去除一维数组中的重复元素用unique()函数,如果要去除二维数组中的重复行该怎么操作呢? def remove_duplicate(nums:List[List[int]]): for v in nums: v.sort() nums = set([tuple(v) for v in 阅读全文