You are viewing a single comment's thread. Return to all comments →
Comments on how better it could be optimized are appreciated.
My c++ code :-
int getMoneySpent(vector<int> keyboards, vector<int> drives, int b) { int max = -1; int sum = 0; for(int i = 0; i < keyboards.size(); i++){ for (int j = 0; j < drives.size(); j++){ sum = keyboards[i]+drives[j]; if (sum > max && sum <= b){ max = sum; } } } return max <= b ? max : -1; }````
Seems like cookies are disabled on this browser, please enable them to open this website
Electronics Shop
You are viewing a single comment's thread. Return to all comments →
Comments on how better it could be optimized are appreciated.
My c++ code :-