You are viewing a single comment's thread. Return to all comments →
My solution in C:
int getMoneySpent(int keyboards_count, int* keyboards, int drives_count, int* drives, int b) { /* * Write your code here. */ int max_cost = -1; for (int i = 0; i<keyboards_count; i++){ for (int j = 0; j<drives_count; j++){ if ((keyboards[i] + drives[j] > max_cost) && (keyboards[i] + drives[j] <= b)){ max_cost = keyboards[i] + drives[j]; } } } return max_cost; }
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 →
My solution in C: