Problems > Sum of the First K Fibonacci Numbers > Editorial

Sum of the First K Fibonacci Numbers — Solution & Editorial

Back to the Problem

Either accumulate directly or use the telescoping identity ∑Fi = FK+2 − 2.

Complexity: O(K) or O(1) with the identity