I am getting WA for 2 subtasks in this question : https://www.codechef.com/problems/KFIB
My solution : https://www.codechef.com/viewsolution/18321444
Could someone please point out my mistake ?
The formula you are using to find the next term (i.e 2*a[i-1] -1) isn't correct .
Try this test case:
Your output: 9
Correct output: 8
Hope it helps :)
Yes, it helped. The formula wasn't totally wrong. I had to add another case. Thank you.