#K34847. Longest Unique Subarray
Longest Unique Subarray
Longest Unique Subarray
Given an array of integers representing the number of users logging in each day, your task is to compute the length of the longest contiguous subarray that contains only unique elements. This is a classical sliding window problem. More formally, you are given an integer \(n\) and an array \(A\) of length \(n\). You need to find the maximum value of \(j-i+1\) such that all elements in the subarray \(A[i], A[i+1], \ldots, A[j]\) (where \(0 \leq i \leq j < n\)) are distinct.
Note: The input is read from standard input and the output should be written to standard output.
inputFormat
The first line of input contains an integer \(n\) indicating the number of days. The second line contains \(n\) space-separated integers representing the number of users for each day.
outputFormat
Output a single integer representing the length of the longest subarray with all unique elements.
## sample7
5 3 3 1 6 9 2
5
</p>