Open eeshwar369 opened 6 hours ago
Wrong Time Complexity Analyser
👋 Thank you for raising an issue! We appreciate your effort in helping us improve. Our CodeIt team will review it shortly. Stay tuned!
Hey @eeshwar369, I understand that the Time Complexity Analyser is noy accurate. But the time complexity of the code in you issue is o(n) and that's what the Analyser is showing? 😕
Would you like to work on this issue? (increasing the accuracy of analyser)
The Issue here is that the time complexity is being analysed only with the loops but the time complexity of functions in it are not getting analysed and yes,I would work to improve the accuracy of this .
include
using namespace std;
class Solution { public: int findgpd(int a, int b) { int ans = 0; for (int i = b; i > 1; --i) { if (a % i == 0) { ans = i; break; } } return ans; }
};
Expecting O(n) time complexity due to single loop but is it so?