Demo task
Ok. Screw you, Codility. Why can you not just mention that we should use BigIntger/BigDecimal class to solve the problem, but instead say:
each element of array A is an integer within the range [−2,147,483,648..2,147,483,647].
Ok. I did it with BigInteger class again:
Well, what's the problem now? I know. I had to write: if(A.length == 0) return -1;, not return 0;. But for the next error in the performance test, I don't know what the problem is, since I've already got the time complexity of O(N) with two for-loops iterating N times respectively.
yeap. I tried again got a full percentage for correctness test. But I don't know what's wrong about the timeout error. Just ignore it. LOL.