My perf-test cases are failing

Modified on Tue, 28 Mar, 2023 at 4:38 PM

Do you understand the error?

Perf-test cases fail if the required performance is not met, in some cases if you unlock and run these you might also get the right output. 

Where is the error occurring?

If Only performance test cases are failing either the time complexity of your code is not meeting the requirements or you’re not using the right data types to store the value. Can you look at the code and check what is the time complexity of it?

Why do you think you are seeing this error? What might be causing it?

There are mainly 2 reasons why you would perf-test cases:

  1. You’re not using the right data type, for example you might need a long variable to store values but you might be using int.

  2. You’re not using the optimized approach, you might be implementing an O(N^2) but the problem can be solved in O(N)

How to Debug this? To debug this issue, I would recommend the following steps:

You can follow these steps to find and solve this issue: 

  1. Take a look at the input constraints of the problem.

  2. Identify what should be the time complexity of the solution based on the provided input constraints.

  3. Optimize your solution (use of different data structure or reduction of loops etc.) to reduce the time complexity. 




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article