| about | help | code help+videos | done | prefs |
Given an array of integers with at least one element, return an integer array such that there is an index that represents each number found in the source array and at the index is stored how many times a each number was found. For example, the source array:
{1,3,5,3,5,5}
would generate an array:
{0,1,0,2,0,3}
because there are no 0's in the source array, there is a single 1, no 2's, but two 3's, no 4's, and three 5's.countOccur([1, 3, 5, 3, 5, 5]) → [0, 1, 0, 2, 0, 3] countOccur([0]) → [1] countOccur([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) → [2, 1, 1, 1, 1, 1, 1, 1, 1, 1] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 300 Post-solution available
Copyright Nick Parlante 2017 - privacy