Longest Subarray With At Most K Frequency

Given an integer array nums and an integer k, return the length of the longest contiguous subarray in which every distinct value occurs at most k times.

Examples
Input: [[1,100,1],1]
Output: 2
Hints

Longest Subarray With At Most K Frequency

Given an integer array `nums` and an integer `k`, return the length of the longest contiguous subarray in which every distinct value occurs at most `k` times.