Last Digit of Fibonacci — Solution & Editorial
Fibonacci mod 10 repeats with period 60 (the Pisano period): precompute one period and index with N mod 60.
Complexity: O(1) after a 60-step table
Fibonacci mod 10 repeats with period 60 (the Pisano period): precompute one period and index with N mod 60.
Complexity: O(1) after a 60-step table