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

 

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

Write a method that accepts an array of integers with each element an integer between 0 and 9 inclusive. Return an array with the index indicating the integer, and the value in the return array indicating how many times that integer occured. For example, if an array is passed in containing 5 3's and 2 9's in any order, the array to return would be {0, 0, 5, 0, 0, 0, 0, 0, 2}. Look at the test data for further examples.


bbvdNumCountAdvanced1([5, 6, 5]) → [0, 0, 0, 0, 0, 2, 1, 0, 0, 0]
bbvdNumCountAdvanced1([7, 7, 6, 6, 5, 5, 4, 4, 5, 5]) → [0, 0, 0, 0, 2, 4, 2, 2, 0, 0]
bbvdNumCountAdvanced1([8, 8, 4, 2, 8]) → [0, 0, 1, 0, 1, 0, 0, 0, 3, 0]

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

public int[] bbvdNumCountAdvanced1(int[] nums) { }

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

Copyright Nick Parlante 2017 - privacy