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