I thought that my solution which finds next_num(4028521680729008280092) is 5672520000485856186064 is quite optimal, its uses only about 78204 internal cycles (gap between polydivisible numbers is 1_643_998_319_756_847_905_972). But this is not enough.
PS. It turns out to be enough, but in the description it is written that there is a limited number of them, and after the last one in the test, my algorithm falls into an infinite loop.
PPS. I will not hide this hint under a spoiler, because I do not reveal the algorithm itself, but maybe I will save someone a lot of nerves and time.
author here. the description states "... but NOT 23:21:19", showing that the sequence must not be decreasing. It might have been confusing however, so I've altered the description. How's this?
I spent some time to detect both growing (increasing) and falling (descending) arithmetic progressions to comply with the rule 1.
But then spent more time to understand what needs to be detected only increasing (growing) arithmetic progression.
you're supposed to call the methods on an instance, not on the class
(the design of the task is completely bloated, actually, these should have been static or better, class methods. But definitely not instance methods)
TypeError: method() takes exactly 1 positional argument (2 given)
Explicitness is good for whoever is reading your code, but you've got to know how much explicitness is too much.
This comment is hidden because it contains spoiler information about the solution
Super clean and readable!
I thought that my solution which finds next_num(4028521680729008280092) is 5672520000485856186064 is quite optimal, its uses only about 78204 internal cycles (gap between polydivisible numbers is 1_643_998_319_756_847_905_972). But this is not enough.
PS. It turns out to be enough, but in the description it is written that there is a limited number of them, and after the last one in the test, my algorithm falls into an infinite loop.
PPS. I will not hide this hint under a spoiler, because I do not reveal the algorithm itself, but maybe I will save someone a lot of nerves and time.
when it seems you are doing the right thing and tests says no.
then you make such hard code
and the tests say that they don't care what you return.
Python translation
Python translation
Python translation
I don't know if it is possible in python not to create an instance of the class or the class itself to be able to address its attributes.
therefore, you have to make the NumClass itself, and in the tests create instance Num = NumClass(), on which the tests are made.
It is also possible to discuss the need to implement dunder methods for comparison (equality), arithmetic. because it wasn't in the original kata.
wow!
I upvoted this as best pratices, but not because I think it's a best practice, but so that more people will see it.
Double check your code.
I had false answer for this case too. Only because I compare correct addendums of checksum I found typo error in my code.
author here. the description states "... but NOT
23:21:19
", showing that the sequence must not be decreasing. It might have been confusing however, so I've altered the description. How's this?I spent some time to detect both growing (increasing) and falling (descending) arithmetic progressions to comply with the rule 1.
But then spent more time to understand what needs to be detected only increasing (growing) arithmetic progression.
When I looked at the name of this kata, I thought that I would have to calculate the difference between bit arrays, not whole characters.
Loading more items...