• + 0 comments

    Not clear: if V[n-1] is 999 and V[0] is 0 would the following be wrong:

    if(V[n-1]-V[0]==1) c++;

    Simple case {0, 999}, the answer should be 40000002, but it is 40000000 !