Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The description specifically says: Input range:
ord_max <= 1000I just figured that out while re-reading both anter69 and the other user's (who used a list) solutions. I guess this is just a trade-off between memory and time complexity. I'd not thought of taking it to an arbitrary number like 1000 (is that considered best practice?), although here it is practical and makes sense. Somehow, I can almost never think of creating a too large iterable.
if you fork and run it you'll see it runs under 3 seconds.
How did this pass the longer tests? That sum and str are too heavy operations and for me they did not pass. I had to completely change the algorithm to make it pass. :(
Yes you can. In such case Python internally uses
floatrepresentation of a givenintto compare the values so you don't have to worry about type conversion.In Python it doesn't work that way for all type pairs e.g.
strwithint(orfloat). One of the languages which allows such comparisions (intwithstr) is JavaScript and it sometimes end up with surprising logical bugs.I tried to avoid double listing thinking about the time efficiency which I am not sure about. Can you tell me the time-efficiency of this vs my solution, please?
any love for this translation?
but can we compare int to float (by the way i am begginer)
The return line is smart!
Description says: "An occurrence of 'and' and/or 'but' only counts when it is at least one space separated" but apparently the pyhton fixed tests expect otherwise:
That's effing brilliant!!
interested how I got this? see the fork for a detailed walkthrough
well.. python's modules is cheating.
omg
impressive solution
Thanks, fixed
Loading more items...