2 test cases not passing
hi @ujj1804_1156aee80205d0bf use fact prime no finding method o(root(n))
refer -->
here u need to find the number whose sum of digits are equal to sum of digits of its factor except 1
check here for implementation ive commented the code : https://ide.codingblocks.com/s/656874
Sir so the test cases are not passing due to TLE? Bcz my code is same as yours except the complexity.
I am talking about my code sir , your code is of O(root n) but mine is O(n) so , my code didnt pass 2 cases because of complexity?I have run your code its passing all test cases , logic of my code is exactly same as yours.Pls tell whats the issue?
Ok sir but how can i judge that test cases are failing bcz of complexity? Can i get some hint from range of N?
@ujj1804_1156aee80205d0bf r u seeing TLE? IF YES then coz of time complexity.
That varies from question to question
No its not showing TLE, as Value of N is large i guessed that
@ujj1804_1156aee80205d0bf no your code is incorrect as it says number whose sum of digits are equal to sum of digits of its factor except 1 not adding factors but u need to add sum of digits of factor which ive done
I have also added the sum of digits of factors
suppose factor is 13 then u r adding 13 but u need to add 1+3
Thank u very much sir , can u tell one thing that after the changes told by u , my code worked fine , but for loop is working for n times and inside that there is a while loop also , so why its not giving TLE as N has a range 1 < N < 2,147,483,647 (max value of an integer of the size of 4 bytes)
Here the test case don’t have large values that’s y
Ok sir , doubt clear , but generally as in 1 sec 10^6 executions occur , so this this of large N will give TLE right?
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.