Wrong Test cases

The range of inputs was between 1-1000 for all the inputs, so I used ‘short int’ as the datatype for the variables and arrays. I tried submitting the code 4 times, it couldn’t pass the test case. Then I just reset the datatype to be ‘int’, and the code was accepted.
Why are the test cases giving errors when I try to submit a code which might use less space?

Hi @abhishekjoshi, you might have used short int everywhere except for required and that might be posing a problem. One possibility is that you would have also used short int as data type for your answer variable. Pls rewrite the code by assigning short int to required variables and not all of them.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.