Why is the brute-force approach less ideal here?
Practice this question from Binary Exponentiation - Fast Power Pattern Practice Quiz, with options and an explanation.
Question
Why is the brute-force approach less ideal here?
Option A — Correct answer
Repeated multiplication costs O(exp) and can overflow.
Option B
It always has better space complexity
Option C
It skips reading some inputs
Option D
It only works on strings
Explanation
Repeated multiplication costs O(exp) and can overflow.