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

 

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

Rocks are being dropped into bins in order until all the rocks are dropped into bins. For example, given 3 bins and 5 rocks, the first rock would be dropped into bin 1. Next the second rock would be dropped into bin 2. The third rock would be dropped into bin 3. Now we start over with the fourth rock getting dropped into bin 1. The fifth and final rock gets dropped into bin 2. What we want to know is: "What bin number does the last rock get dropped into?" In the example above, the last rock is dropped into bin 2, so we would return a 2. Write a method that returns which bin number the last rock is dropped into. Look at the test data for examples.


test2021_09_16_SLHL_bins(4, 5) → 1
test2021_09_16_SLHL_bins(8, 1220) → 4
test2021_09_16_SLHL_bins(8, 1221) → 5

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

public int test2021_09_16_SLHL_bins(int bins, int rocks) { }

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

Copyright Nick Parlante 2017 - privacy