Optimized Fib Frog time complexity to O(N log N)