Dsa
Sliding Window
Medium
Max Unique Subarray Sum
You're working with an array of integers where each integer can only appear once in a valid subarray. Find the maximum sum of such a valid subarray.
Input:
A single line with n integers (1 <= n <= 1000).
Output:
An integer representing the maximum sum of a unique integer subarray.
Example:
Input:
4 5 1 3 2 3 2
Output:
15
Key concepts
sliding_windowarrayset
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now