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

 

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

Write a method that accepts an input parameter containing an array of non-negative integers called 'nums'. Return an array of integers, where the index in the array represents a digit, and the value stored at that index represents how many times that digit appeared in any of the numbers in the 'nums' array. For example, if the input array contained: {25, 52, 755} you would return {0, 0, 2, 0, 0, 4, 0, 1, 0, 0}. Notice, for example, why the resulting array contains a 4 at index 5. This is because the digit '5' appears a total of 4 times in the 'nums' array.


test2024_10_08_HL_digitCount([214, 234346, 456, 54, 539, 235, 9540, 500, 1468, 7508, 90]) → [5, 2, 3, 4, 7, 7, 3, 1, 2, 3]
test2024_10_08_HL_digitCount([853, 9460, 412, 643, 3297, 1240, 4402, 500, 400, 50000, 100000, 1020304]) → [19, 4, 5, 4, 8, 3, 2, 1, 1, 2]
test2024_10_08_HL_digitCount([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) → [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

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

public int[] test2024_10_08_HL_digitCount(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