Function to check if array can be split into K consecutive and non - overlapping subarrays of length M consisting of a single distinct element
function checkPattern ( arr , m , k , n ) { let count = 1 , t = 0 ;