CSES Problemset/Sorting and Searching
Playlist
#1141Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopYou are given a playlist of a radio station since its establishment. The playlist has a total of songs.
What is the longest sequence of successive songs where each song is unique?
Input
The first input line contains an integer : the number of songs.
The next line has integers : the id number of each song.
Output
Print the length of the longest sequence of unique songs.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
8 1 2 1 3 2 7 4 2
Expected Output
5
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
8 1 2 1 3 2 7 4 2
Expected Output
5