You're making a histogram from a set of data. It's a bar graph of "bins" (ranges) of numbers vs. their frequency in the set. The return value is the heights of the columns in the histogram.
For the data [1, 1, 0, 1, 3, 2, 6], binWidth = 1 in the example, there is one 0, three 1s, one 2, one 3, no 4s, no 5s and one 6, so the output will be [1, 3, 1, 1, 0, 0, 1] -- the frequencies of each element for all the possible bins. Each bin just contains a single number.
If binWidth = 2, each bin covers two numbers. The first bin matches 0 and 1, the second 2 and 3, and so forth.
Still O(n) time complexity as args.Min() has to iterate through the whole string in worst case similar to a for loop
Are u serious? I`m gonna practice more...
Another opportunity to practice with LINQ (◕‿◕)
There are 54 data points but only 3 unique values. How can a histogram have more than 3 bins?
[2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 2] should equal [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 2]
pass
Python:
New test framework should be used
Corresponding imports are missing in test cases
oh
This comment is hidden because it contains spoiler information about the solution
Check {0,0,9,9}, Bro :)
okay don't need to complain about the solution actualy obviously that's a basic question so it doesn't matter how you solve it
You're making a histogram from a set of data. It's a bar graph of "bins" (ranges) of numbers vs. their frequency in the set. The return value is the heights of the columns in the histogram.
For the data
[1, 1, 0, 1, 3, 2, 6], binWidth = 1
in the example, there is one0
, three1
s, one2
, one3
, no4
s, no5
s and one6
, so the output will be[1, 3, 1, 1, 0, 0, 1]
-- the frequencies of each element for all the possible bins. Each bin just contains a single number.If
binWidth = 2
, each bin covers two numbers. The first bin matches0
and1
, the second2
and3
, and so forth.No matter how many times I read the description, I don't understand what is being asked.
Good question. Not necessary, not sure why I had them included.
This comment is hidden because it contains spoiler information about the solution
The expected result was wrong in the tests. Fixed.
Loading more items...