Problem Description

Given an array, find the longest contiguous subarray that contains at most 2 distinct numbers. Print its length.

Input Format

One line: n then n integers.

Output Format

One integer length.

Sample Test Case

Input:
7 1 2 1 3 4 3 3
Output:
4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next