Solution failed to pass even though the actual output is same as the expected output

  • Last updated on July 7, 2023 at 6:37 PM

This issue typically happens to due to rounding errors. As computers have a precision limit when doing arithmetical operations, any calculation that breaches this limit would have to round the result to the maximum possible precision. Hence, the same operation performed using different approach will result in a slightly different result. Here is an example:

For example consider these two operations:

print(4.6767688495849487 * 100 / 10000)

0.04676768849584949

print(100 / 10000 * 4.6767688495849487)

0.046767688495849495

We just switched places and the result was slightly different. And this minor difference is what is preventing our answer checker to evaluate your solution correctly.

Until we found a fix for this issue, please use the same approach used by the solution code if you encounter this error.