Why test case shows run error at submit time

5

3

10

20

30

35

my ans->
4

9496

758663935

660627721

443090816

@S18CRX0174
Please send your code

@S18CRX0174
I’m sure you can understand no one will be able to understand the way you have sent your code
Please send on CB IDE with proper indentation ide.codingblocks.com

cb ide sharing option is not working

@S18CRX0174
Please try ideone then

ideon link of my code

@S18CRX0174
You forgot to add the link

i don’t know what is happenning, i have shared but it’s not showing

please use leetcode link that i have shared , it’s live and you can manage and run code

@S18CRX0174
You can see the code here


Firstly precalculate all results and not calculate each time you get a query
run time error was because input N may be 0 or 1 but you tried to initialise values till 2

If your doubt is resolved please close it

this ide sucks, i have submitted same problem in gfg

@S18CRX0174
Buddy due to corona the current traffic on CB IDE is 10-20 times normal
I hope you can understand the IDE is by itself really amazing but it was probably not able to handle an issue of this magnitude

If your doubt is resolved please close it