Problems > Compound with Memory > Editorial

Compound with Memory — Solution & Editorial

Back to the Problem

The process is a linear recurrence; exponentiate its 2×2 companion matrix.

Complexity: O(log N)