Ezvor

3641. Longest Semi-Repeating Subarray

MediumArray Preparing judge… LeetCode
ArrayHash TableSliding Window

Hints

Hint 1
Use a sliding window with left/right pointers.
Hint 2
Keep a freq map and a count of elements with freq > 1.
Hint 3
If repeating-count > k, shift the left pointer until it's <= k.