Bucket size should be the same as input array size, is it right?

  • 0

    Here are the solution from the official site:

    Suppose there are N elements and they range from A to B.
    Then the maximum gap will be no smaller than ceiling[(B - A) / (N - 1)]
    Let the length of a bucket to be len = ceiling[(B - A) / (N - 1)], then we will have at most num = (B - A) / len + 1 of bucket

    So, what is the core concept of this problem? it is the bucket size.
    So, can we make it more simpler? that is, how many numbers are there in the input array, how many buckets should we have....

    Thanks and wish to see your comments.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.