#C11425. Longest Unique Subarray

    ID: 40740 Type: Default 1000ms 256MiB

Longest Unique Subarray

Longest Unique Subarray

Given an array of integers, determine the maximum length of a contiguous subarray that contains only unique elements. In other words, find the largest integer \(L\) such that there exists a contiguous segment of the array with \(L\) distinct elements. This classic problem can be efficiently solved using the sliding window technique.

Input is provided via standard input (stdin) and the result should be output to standard output (stdout).

inputFormat

The first line contains a single integer \(N\), representing the number of elements in the array. The second line contains \(N\) space-separated integers.

outputFormat

Output a single integer representing the length of the longest contiguous subarray with all unique elements.

## sample
1
5
1

</p>