Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
Why the outermost loop? Are you supposed to repeat the process n times?
26th Aug 2020, 10:28 PM
Sonic
Sonic - avatar
+ 4
Since you are doing in hacker rank I think it's for competitive programmers so your output should be given as fast as possible .As I remember ,you have to give output within 2 sec. Since your code is taking time that's why they are showing runtime error. My suggestion try to make your logic strong.
26th Aug 2020, 8:26 AM
The future is now thanks to science
The future is now thanks to science - avatar
26th Aug 2020, 8:44 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
It should give multiple output. because you declared while(n--)
26th Aug 2020, 9:02 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 if I write 2 5 6 what will be the expected output you should get according to the question?(I am asking because I don't know the question)
26th Aug 2020, 9:06 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 ,Your code is working on first case.
26th Aug 2020, 9:15 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 also works in codeblocks .
26th Aug 2020, 9:17 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Namit Jain ,something is different 🤔.I have copied and pasted atefish code but I can see right answer: https://code.sololearn.com/cja1eD0L0h7l/?ref=app
26th Aug 2020, 9:29 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Namit Jain , Input formate: 1//number of test case 111/the number Output: 3 I have tried your code: 1 111 the output is 6 . In atefish code the output is 3.
26th Aug 2020, 9:34 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Namit Jain , Karnet Number a number which is a factor of every digit is has... Such as 126 is a karnet number cause 1 is a factor of 126 2 is also and 6 is also We have to print how many times the number % digit ==0 Just need to check the reminder of bigger number and his digit.
26th Aug 2020, 9:52 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 not solved?
26th Aug 2020, 9:54 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 121%1=0 121 is a number Number%digit=0 121%1(1st digit)=0 121%2(2nd digit)=1 121%1(2nd digit)=0 As we see there are 2 factors of 121 of digits so output 3 not 3 answer 2 (if input 121)
26th Aug 2020, 9:58 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
AteFish🇧🇩 i think you should not used n— in while loop. i cleaned up your code, and it does nit produce any runtime error anymore. also, for me avoid using ? ternary operator. here is my code pls tell me if it not produces runtime anymore in your laptop https://code.sololearn.com/cl1f74570W5G/?ref=app
27th Aug 2020, 3:23 AM
Jizza Abayon
Jizza Abayon - avatar
+ 2
Just trying to do it without vector. But it is way longer 😂 https://code.sololearn.com/cyxzGa6z8O8h/?ref=app
27th Aug 2020, 4:37 AM
Ipang
+ 1
Did you mind the constraints of the problem?
26th Aug 2020, 8:33 AM
Hima
Hima - avatar
+ 1
AteFish🇧🇩 problem link ?
26th Aug 2020, 9:06 AM
Hima
Hima - avatar
+ 1
AteFish🇧🇩 Error not coming in your code but: The output is wrong! As far as I understand the question 🤔 I have made this code! Check it out and it will work for any number of digits (Sorry donno C++) If you want the C++ version of this code then pls tell! I ll have to search for the syntaxes on Google https://code.sololearn.com/cbyfp9AuXMHl/?ref=app
26th Aug 2020, 9:23 AM
Namit Jain
Namit Jain - avatar
+ 1
Samsil Arefeen Try to enter: 226 and 634
26th Aug 2020, 9:31 AM
Namit Jain
Namit Jain - avatar
+ 1
Samsil Arefeen 1 1 1 Place1 Place2 Place3 Case1: Place1 % Place2 = 0 1 Case2: Place1 % Place3 = 0 +1 Case1: Place2 % Place1 = 0 +1 Case2: Place2 % Place3 = 0 +1 Case1: Place3 % Place1 = 0 +1 Case2: Place3 % Place2 = 0 +1 = 6 What's the problem?
26th Aug 2020, 9:49 AM
Namit Jain
Namit Jain - avatar