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.
functiongetMoneySpent(keyboards,drives,b){/* * I know the solution is pretty straight forward, but I like my formating the best */letmostExpensivePurchase=-1;for(leti=0;i<keyboards.length;i++){for(letj=0;j<drives.length;j++){letsum=keyboards[i]+drives[j];if(sum<=b&&sum>mostExpensivePurchase)mostExpensivePurchase=sum;}}returnmostExpensivePurchase;}
Electronics Shop
You are viewing a single comment's thread. Return to all comments →