Published on: 25th May 2018. Day 12: Inheritance. I am not going to explain this here. Solution Use the equation for Fibonacci numbers in problem statement: Fibonacci(n) = 0 , n = 1 Fibonacci(n) = 1 , n = 2 Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2) , n > 2. The page is a good start for people to solve these problems as the time constraints are rather forgiving. I'm stuck with this problem on Hackerrank, regarding the dynamic programming in the Algorithms section . Solution: Please check the FibonacciNumber.java snippet for the solution. HackerRank Solution: Fibonacci Modified. The Fibonacci sequence appears in nature all around us, in the arrangement of seeds in a sunflower and the spiral of a nautilus for example. s=0; f0=1; f1=1; L=4000000 while f1