You are viewing a single comment's thread. Return to all comments →
c++14
void countApplesAndOranges(int s, int t, int a, int b, vector<int> apples, vector<int> oranges) { size_t val_apple=0; size_t val_orange=0; for (const auto& x: apples) { if((x + a) >= s and (x + a) <= t){ val_apple++; } } for (const auto& x : oranges) { if( (x + b) <= t and (x + b) >= s){ val_orange++; } } cout<<val_apple<<'\n'; cout<<val_orange<<'\n'; }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
c++14