id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > swapMeet
prev  |  next  |  chance

Write a method called "swapMeet" that accepts two integer arrays as input parameters. The first array contains the dollar values of all the items you are considering swapping out. The second array contains the dollar values of all the items you are hoping to get in the swap. A swap is considered "good" if the total value of the items you get is greater than the total value of the items you swapped away. Return true if the swap is "good", return false otherwise. Note that all items being swapped will be worth at least one dollar.


swapMeet([4, 23, 7, 1], [6, 3]) → false
swapMeet([14, 2, 3, 4, 5, 4, 3, 2, 2], [400]) → true
swapMeet([104, 324, 423], [880]) → true

...Save, Compile, Run (ctrl-enter)

public boolean swapMeet(int[] giveAway, int[] getBack) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 380

Copyright Nick Parlante 2017 - privacy