@@ -0,0 +1,1076 @@
+package checkpoints;%0A%0Aimport java.util.ArrayList;%0A%0A/*%0A * Given an array of non negative integers A, and a range (B, C), %0Afind the number of continuous subsequences in the array which have sum S in the range %5BB, C%5D or B %3C= S %3C= C%0A%0AContinuous subsequence is defined as all the numbers A%5Bi%5D, A%5Bi + 1%5D, .... A%5Bj%5D%0Awhere 0 %3C= i %3C= j %3C size(A)%0A%0AExample :%0A%0AA : %5B10, 5, 1, 0, 2%5D%0A(B, C) : (6, 8)%0Aans = 3 %0Aas %5B5, 1%5D, %5B5, 1, 0%5D, %5B5, 1, 0, 2%5D are the only 3 continuous subsequence with their sum in the range %5B6, 8%5D%0A%0A NOTE : The answer is guranteed to fit in a 32 bit signed integer. %0A */%0A%0Apublic class NumRange %7B%0A%09%0A%09public int numRange(ArrayList%3CInteger%3E a, int b, int c) %7B%0A%09    if(b%3Ec %7C%7C c%3C0) return 0;%0A%09    int n = a.size(), count=0;%0A%09    %0A%09    for(int i=0; i%3Cn; i++)%7B%0A%09        int sum = 0;%0A%09        for(int j=i; j%3Cn; j++)%7B%0A%09            int current = a.get(j);%0A%09            sum += current;%0A%09            if(sum%3Ec) %7B%0A%09                sum = 0;%0A%09                break;%0A%09            %7D              %0A%09            if(sum%3E=b && sum%3C=c) count++;%0A%09        %7D%0A%09    %7D%0A%09    %0A%09    return count;%0A%09%7D%0A%0A%7D%0A

num range