Function to find the maximum profit from the given values
static int maxProfit ( int [ ] value , int N , int K ) { Arrays . sort ( value ) ; int maxval = value [ N - 1 ] ; int maxProfit = 0 ; int curr_val ;