You are viewing a single comment's thread. Return to all comments →
int activityNotifications(vector<int> expenditure, int d) { int cnt=0; int k=int(d/2); vector<int>::iterator it; int med; for(it=expenditure.begin();it<expenditure.end()-d;it++) { vector<int> a(it,it+d); sort(a.begin(),a.end()); if (d % 2 != 0) { if (*(it + d) >= 2 * (a[k])) { cnt++; } } else { med = (((a[k] + a[k - 1]) / 2) + 1) * 2; if (*(it + d) >=med) { cnt++; } } } return cnt; }
I am getting timed out error. Can you help me out?
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 am getting timed out error. Can you help me out?