Back to problems

Latency Bucket Counter

Algorithm · Datadog · Easy

You are given a sorted array of positive integers called latencies, each representing a request's latency in milliseconds, along with an integer bucketWidth that defines the span of each bucket. The total number of buckets is specified by numOfBuckets, labeled 0 through numOfBuckets - 1. For any i except the final bucket, bucket i covers the inclusive latency range [i * bucketWidth, (i + 1) * bucketWidth - 1]. The last bucket is an overflow category that captures every…

Checking your access…