You are viewing a single comment's thread. Return to all comments →
You don't even have to store the array, you can do the counting inline while reading the input:
int apples = 0; for(int i=0; i < m; ++i){ long d = in.nextLong(); long p = d+a; if ( p >= s && p <= t ) ++apples; }
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
You don't even have to store the array, you can do the counting inline while reading the input: