Hey dear! Can you tell me what you did in this line of code-

```
private long power(final long[] powersOf10, final long exponent, final long m) {
long result = 1;
for (int i = 0; i < 64; i++) {
if (((exponent >> i) & 1) != 0) {
result = (powersOf10[i] * result) % m;
}
}
return result;
}
```

Here you compared if a position on a is 0 or 1 (in binary) and likewise did operations on result and returned it. Then you stored it in power[0]. Whats the purpose of this? I was under impression that we only had to use rem[I] = (rem[I-1] + rem[I-1]*powerTen[I-1])%m;

Also, that function takes parameter of a * length of a if I interpret correctly. I thought its n * len(a)

Your help would be appreciated!!

EDIT- I solved the Q on hackerrank (FINALLY AFTER MORE THAN 30 HOURS OF GRUELSOME, CRUEL CODING)

I REALLY APPRECIATE ALL THE HELP YOU GAVE!!

I just have a small conceptual doubt in addition of doubts above. In your code, you defined answer as-

long answer=0

and-

answer = ((answer * powers[i]) % m + result[i]) % m;

My implementation like-

answer= (answer + rem[I]*b[I])%m; //consider this rem only if binary value of n here is 1.

Whats the role of power of tens here? That’s the last doubt, I promise.