最大子数组之和完成心得--贪心算法的应用
摘要:
int pre = 0, maxAns = nums[0]; for (int x : nums) { pre = Math.max(pre + x, x); maxAns = Math.max(maxAns, pre); } return maxAns; 使用贪心算法,在导入的数组中,初始化初始值 阅读全文
posted @ 2022-10-28 18:20 MaoIno 阅读(33) 评论(0) 推荐(0)
浙公网安备 33010602011771号