A file-integrity tool computes a checksum a^b mod 1337, where b is so large that it's stored as an array of its decimal digits, digits, most significant first (for example [1, 0] means 10).
Write towerChecksum(a, digits) that returns a^b mod 1337. b is at least 1.
Input: a = 2, digits = [3] Output: 8
2^3 = 8.
Input: a = 2, digits = [1,0] Output: 1024
b is 10, and 2^10 = 1024, which is less than 1337.
0 <= a <= 2^31 - 11 <= digits.length <= 10^50 <= digits[i] <= 9, digits has no leading zeros, and b >= 1.Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #642 Power Tower Checksum. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.