We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Electronics Shop
Electronics Shop
Sort by
recency
|
2352 Discussions
|
Please Login in order to post a comment
static int getMoneySpent(int[] keyboards, int[] drives, int b) { /* * Write your code here. */ Arrays.sort(keyboards); Arrays.sort(drives); int max=0; for(int i=0;i=0;j--){ if(drives[j]+keyboards[i]<=b){ if(max
Python3
JavaSolution
Comments on how better it could be optimized are appreciated.
My c++ code :-
Will it be more optimized if we sort both arrays first?