Largest Subarray With Contiguous Elements

easy
1. You are given an array(arr) of integers. Values may be duplicated.
2. You have to find the length of the largest subarray with contiguous elements.

Note -> The contiguous elements can be in any order(not necessarily in increasing order).

Input Format

A number N arr1 arr2.. N numbers

Output Format

A number representing the length of the largest subarray with contiguous elements.

Constraints

1 <= N <= 10^4
1 <= arr[i] <= 10^3

Example

Input
3
10 12 11
Output
3
Previous
Count Distinct Elements In Every Window Of Size K
Next
Count Of All Subarrays With Zero Sum

Related Questions