You are given an array of size N and an integer K. Your task is to find the largest subarray of the provided array such that the absolute difference between any two elements in the subarray is less than or equal to K.
Let M and m be the maximum and minimum value in the selected largest subarray. Now, M−m≤k must hold.
Print the length of the largest subarray.
Input format
Output format
Print the answer as described in the problem statement.
Constraints
1≤N≤106
1≤K≤106
1≤ArrayElements≤106
We can select the subarray starting from index 2 to 4 of length 3.