Need help in finding the edge testcase in problem - AVGARR

Here is my submission - AVGARR
It is failing in just one sub task.
If I can get some idea about which testcase it is failing then I can rectify my program.

1
1000 0
last element of array will not be in range [-1000,1000]

1 Like

So it was not working for N = 1000 and X = 0. (thanks to @loukiknaik )
I made some changes and wrote this instead.
And it is failing the same subtask for some reason.

Hey @dravitgupta
Thanks for asking your query! Here’s how to resolve it :point_down:

In your else part of your code when a*b is not equal to 0.You forget that a*b can be outside the range [-1000, 1000] , as 1<=a<=1000 and 0<b<=100.

here is a test case in which your code fails

1
1000 100
2 Likes

thanks@prajjwal07_adm , i had the same problem.