I'm attempting to create an algorithm that can sort an array of integers in O(N) time.

The number of digits in all of the intergers is N

Each element has an unknown number of digits

The algorithm should sort the array in O(N) time regardless of how the digits are distributed

I have a working solution for this problem, that runs in O(N) time, I'm just having trouble trying to prove that it does so.

Create a set of N buckets and add items to their corresponding bucket based off how
many digits are in the integer -O(N)
Radix sort each bucket, and then concatenate the buckets back together.
Sum k=0 to N of O(k*n)
k = Number of digits
n = number of items with k digits

The solution that I have come up with is that the ∑k*∑n will always equal N.