Function to print the count of Array elements greater than all elements on its left and next K elements on its right
function countElements ( arr , n , k ) { var s = [ ] ; var next_greater = new Array ( n + 1 ) . fill ( n ) ;