You are viewing a single comment's thread. Return to all comments →
Cpp Soln
void plusMinus(vector<int> arr) { float cp=0, c0=0, cn=0, n=arr.size(); for(int i:arr){ if(i==0) c0++; else if(i>0) cp++; else cn++; } cout << setprecision(6) << cp/n << "\n" << cn/n << "\n" << c0/n; }
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
Cpp Soln