Execution Timed Out (12000 ms) when running a Kata about converting decimals to binary #3354
-
Hello! I'm trying to do a challenge, it says that everything works fine but the problem it's the execution time, I tested it on my machine and it also works fine the problem is the execution time Is there a way to optimize this code? I used my knowledge of binary for adding numbers.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Forgot to add the link for the kata my bad (mod edit: removed direct link to trainer) |
Beta Was this translation helpful? Give feedback.
-
Well your solution goes into a loop which lasts N times, so if N is really big, for example 77231418, then it takes a really really long time. You need to work out a way to do it faster than this. Maybe look up what built in functions Python has for dealing with binary |
Beta Was this translation helpful? Give feedback.
-
Please note that Github Discussions are not meant for discussions about specific kata. For help with solving, you can ask a question in the discourse section of the kata, or visit the I am closing this discussion as off-topic for Github. |
Beta Was this translation helpful? Give feedback.
Well your solution goes into a loop which lasts N times, so if N is really big, for example 77231418, then it takes a really really long time. You need to work out a way to do it faster than this.
Maybe look up what built in functions Python has for dealing with binary