# Maximum Sum of Nearly Unique Subarray (LeetCode 2688)
## Approach
Sliding window + freq map; shrink when unique count exceeds k.
## Edge cases
k=1 and full-array unique.
## Practice tip
State complexity before coding.
Interview prep: [AI interview copilot](https://www.linkjob.ai/interview-copilot/).