You are viewing a single comment's thread. Return to all comments →
i did this solution: but only 5/8. what is wrong?
public static int activityNotifications(List expenditure, int d) { int counter=0; int sum=0;
for(int i=0;i<d;i++){ sum+=expenditure.get(i); } for(int i=d; i<expenditure.size();i++){ double avg=(double)sum/d; if(expenditure.get(i)>=2*avg){ counter++; } sum-=expenditure.get(i-d); sum+=expenditure.get(i); } return counter; }
Seems like cookies are disabled on this browser, please enable them to open this website
Fraudulent Activity Notifications
You are viewing a single comment's thread. Return to all comments →
i did this solution: but only 5/8. what is wrong?
public static int activityNotifications(List expenditure, int d) { int counter=0; int sum=0;