1. You will be given an array of size n.
2. You need to find the longest harmonious subsequence in it.
3. A harmonious sequence is defined as the a sequence wherein difference between its biggest and smallest element is exactly 1
4. Return this length of this subsequence
5. Input and output is handled for you
6. It is a functional problem, please do not modify main()
Input Format
Input is handled for you.
Output Format
Output is handled for you.
Constraints
1 <= N <= 2000
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
8 7 6 8 5 8 8 9 2
Output
4