摘要: 暴力法,多次循环检查,直到满足条件。 public int candy(int[] ratings) { int[] candies = new int[ratings.length]; Arrays.fill(candies,1); boolean flag = true; int sum = 0 阅读全文
posted @ 2020-07-13 16:04 欣姐姐 阅读(166) 评论(0) 推荐(0)
摘要: 自己完成了,但是效果好像并不怎么样 public int canCompleteCircuit(int[] gas, int[] cost) { int len = gas.length; if(len == 1){ return gas[0] >= cost[0]?0:-1; } int sum1 阅读全文
posted @ 2020-07-13 10:46 欣姐姐 阅读(168) 评论(0) 推荐(0)