If the difference is less than or equal to the available chances then pick all numbers
int Sum = 0 ; for ( int i = start ; i < N ; i ++ ) { Sum = Sum + arr [ i ] ; } return Sum ; } int sum = 0 ; for ( int i = start ; i < N ; i ++ ) { sum = sum + arr [ i ] ; }