0
How to convert N^3 time complexity solution to N^2 time complexity solution in C++ ?
I have written an solution with time complexity of order of N^3 but while submitting this solution i get time limit exceeded error for large input. How can we reduce the time complexity to N^2 as the size of input is 1000 and online judge accepts the solution with time complexity of order of N^2 for this size of input? Is their any reference or material to learn on how to reduce the time complexity of any solution? https://code.sololearn.com/c26a226a5A41/?ref=app
4 Respostas
+ 1
MahirShah check out following article,
https://www.geeksforgeeks.org/find-number-of-triangles-possible/
+ 1
Find the count of triplets that form a triangle in an array
0
What does your code do?
0
Thanks