Broken calculator

Dang! You couldn’t score a perfect 100 because you failed one or more testcases. This means that your program didn’t account for all input cases (did you account for negative numbers, for example?).


I am getting the above error one test is not correct it showing me ?

hi @Vikaspal,
in ur code, define MAX as 1000
hope dis resolves ur doubt.

1 Like

@Vikaspal if u use max 500 , result array of size 500 is declared. so if for some value of n , output string has length > 500, it will show a run error. So, thats why max 1000 need to be defined.
Run error mostly occur when u try to access an array/vector for i for which it is not defined. i.e if array[] of size 10 is declared and u try to access array[11].
hope dis resolves ur doubt.
if anything is still not clear, pls post it here

@Yash_N I got your point it is correct but the things is in constraints it is mention the you have to calculate the 100! which is result is almost 158 digits the array[500] is sufficient to store that…

@Yash_N thanku so much if there are another better ways of doing the broken calculator

@Vikaspal the constraint for dis problem is 500.

ya right I forget something

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.