← 返回 netflix 的题目列表Longest Contiguous Subarray with All Unique Show Names
类型:online_judge
Problem: Longest Contiguous Subarray with All Unique Show Names
Given a list of show names shows (array of strings), return the length of the longest contiguous subarray such that all show names in that subarray are distinct.
Input Format
Line 1: integer N
Line 2: N space-separated show names
Output Format
Print one integer
Constraints
0 <= N <= 2e5
Sample Tests
Test 1 Input:
5
A B C A D
Output:
4
(Example: B C A D)
Test 2 Input:
6
A A A A A A
Output:
1
Test 3 Input:
0
Output:
0
Test 4 Input:
7
A B C D E F G
Output:
7
Test 5 Input:
8
A B C B B D E F
Output:
5
(Example: C B D E F)
Example
Input
5
A B C A D
Output
4