Code Room
CodingMedium
Question
Compute a^b mod m using fast (binary) exponentiation, where b is given as a list of decimal digits of a potentially very large exponent (most-significant digit first). Return (a^b) mod m. Constraints: 0 <= a < 10^9, m >= 1, and the digit list has length 1..50 with each entry in 0..9 (no leading-zero requirement; the list [0] means exponent 0).
Implement
pow_big_exp(a: int, digits: list[int], m: int) → intExamples
in
[2,[1,0],1000]out24What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.