HackerRank - Project Euler #2 - Even Fibonacci Numbers

Read the problem statement here:

My Solution in Java:

It has a \(O(n)\) time complexity.

My program passed all the test cases on HackerRank.

This problem can be solved in \(O(1)\) time using heavy maths. Yes! The power of mathematics can do wonders. Read the post here.