Count Subarrays With At Most K Distinct

Asked at Amazon · Coding Questions · Difficulty: Medium

Given `revenues` and integer `k`, count the contiguous subarrays containing at most `k` distinct values. Return the count modulo `1_000_000_007`.

Loading the problem…