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

 

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

Write a method that returns true or false indicating if the maximum possible weight can be packed based on the weights of the individual items in the 'weights' array. Keep in mind that sometimes you can get closer to the maximum by using a larger number of lighter items. For example, if you have weights of {50, 20, 20, 20} and a maximum weight of 62, you can get closer to the maximum weight using the three 20's. Just saying. The index parameter will always be passed in as zero on the first call. This can be useful for you perhaps. Just saying.


orderSystemMaxPackAdvanced2([5, 7, 12, 2, 3], 0, 19) → true
orderSystemMaxPackAdvanced2([4, 9, 1, 200], 0, 201) → true
orderSystemMaxPackAdvanced2([4, 9, 1, 200], 0, 16) → false

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

public boolean orderSystemMaxPackAdvanced2(int[] weights, int location, int maxWeight) { }

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: 490

Copyright Nick Parlante 2017 - privacy