7 kyu
Histogram data
125 of 804Jenik
Description:
You will be given an array of non-negative integers and positive integer bin width.
Your task is to create the Histogram method that will return histogram data corresponding to the input array. The histogram data is an array that stores under index i the count of numbers that belong to bin i. The first bin always starts with zero.
On empty input you should return empty output.
Examples:
- For input data [1, 1, 0, 1, 3, 2, 6] and binWidth=1 the result will be [1, 3, 1, 1, 0, 0, 1] as the data contains single element "0", 3 elements "1" etc.
- For the same data and binWidth=2 the result will be [4, 2, 0, 1]
- For input data [7] and binWidth=1 the result will be [0, 0, 0, 0, 0, 0, 0, 1]
Fundamentals
Algorithms
Arrays
Data Science
Similar Kata:
Stats:
Created | Apr 6, 2016 |
Published | Apr 6, 2016 |
Warriors Trained | 2258 |
Total Skips | 64 |
Total Code Submissions | 3864 |
Total Times Completed | 804 |
C# Completions | 125 |
Python Completions | 693 |
Total Stars | 35 |
% of votes with a positive feedback rating | 90% of 126 |
Total "Very Satisfied" Votes | 107 |
Total "Somewhat Satisfied" Votes | 12 |
Total "Not Satisfied" Votes | 7 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |