Premium problem74. Invert a bincount

Hard Locked

Given an array C of repeat counts, produce a sorted 1-D array A:

  • C[i] is how many times the value i should appear
  • A holds exactly C[i] copies of each i, for every i from 0 to len(C) - 1

Input

[0 2 1 1 2 0 1]

Output

[1 1 2 3 4 4 6]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)