Count of subarrays of size K having at least one pair with absolute difference divisible by K | Java implementation of the above approach ; Function to return the required number of subarrays ; Return number of possible subarrays of length K ; Driver Code
class GFG { static int findSubarrays ( int arr [ ] , int N , int K ) { return N - K + 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 3 , 2 , 17 , 18 } ; int K = 4 ; int N = arr . length ; System . out . print ( findSubarrays ( arr , N , K ) ) ; } }