leetcode_打卡3
解答:
class Solution {
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
int max=0;
int n=candies.length;
List<Boolean> result=new ArrayList<Boolean>();
for(int i=0;i<n;i++){
if(candies[i]>max){
max=candies[i];
}
}
for(int i=0;i<n;i++){
if(candies[i]+extraCandies>=max){
result.add(true);
}else{
result.add(false);
}
}
return result;
}
}
标签:int,max,candies,result,打卡,leetcode
From: https://www.cnblogs.com/ZLey/p/17314409.html