Skip to content

Instantly share code, notes, and snippets.

@cbaykam
cbaykam / fibonacci_solver.rb
Last active May 22, 2018 10:25
Even Fibonacci Numbers
# Uses matrix exponantion algorithm to solve fibonacci sequences
# Complexity O(log n)
# Usage :
# f = FibonacciSolver.new
# f.sum_even(max_value)
# Example: below class declaration, Uncomment to test.
class FibonacciSolver
# calculates the fibonacci sequence's (n)th element
def fib(n)