3940. Limit Occurrences in Sorted Array
You are given a sorted integer array
numsand an integerk.Return an array such that each distinct element appears at most
ktimes, while preserving the relative order of the elements innums.Note: If a distinct element appears at least
ktimes, then it must appear exactlyktimes in the resulting array.
1 | class Solution { |