You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can see the explanation here : https://youtu.be/YJVWinC21Fg
void countApplesAndOranges(int s, int t, int a, int b, vector<int> apples, vector<int> oranges) { int orange = 0, apple = 0; for(int app: apples) if(app + a >= s && app + a <=t) apple++; for(int orr: oranges) if(orr + b >= s && orr + b <=t) orange++; cout << apple << endl << orange; }
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can see the explanation here : https://youtu.be/YJVWinC21Fg