This is the solution for the Fibonacci Modified Problem found under the dynamic programming section at hackerrank. You need to find the (n+k)th term of the generated series, where nth and (n+1)th term will be supplied as input.
The nth and (n+1)th terms, the (n+2)th can be computed by the following relation :
Tn+2 = (Tn+1)2 + Tn
So, if the first two terms of the series are 0 and 1 and k is 5 then
the third term = 12 + 0 = 1
fourth term = 12 + 1 = 2
fifth term = 22 + 1 = 5
Found Bugs, feel free to report them !
Latest posts by Bikash Panda (see all)
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017
- DHT12 Interfacing with Raspberry Pi using Pi4J - June 19, 2017
- Send data using MQTT from Raspberry Pi with JAVA - June 12, 2017