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.
Renaming's not a bad idea; makes the code portable. Not that this needs that in particular...
approved, one thing remained unclear to me from description, an "implicit conversion" is a "from -> to" from bindings (I would say this is an "explicit conversion"). Also "from -> to" and "to -> from" are two different kinds of conversions.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I agree, thats brilliant
The problem is the for loop. For example when
i=2
then with exampleinitial_time = "12:45"
theninitial_time[i]
is":"
which meansinitial_time[i][0:2]
is also":"
, which is an invalid input forint
.@lewissteward448 Please do not abuse the report system. I suggest you drop this topic.
I think you have the tests backwards. Your predicate is expected to behave like a generator, and produce single values at a time. The tests check for this by gathering all the values produced into a list. Your solution however produces one single list of all values at once, so the tests collect that into a list, creating a nested list, while the expected result is just a list.
You need to rebuild your solution to produce individual values. Eg instead of this behaviour:
You need behaviour like this:
@TheChampionofValor This is a warning, do not abuse the report system any further, and stop threatening people.
@AliRain FYI while this translation is rejected, you can simply "Fork" it to keep the work you already did, and use that to implement random tests.
Thanks for the ping! I'm glad the kata is back, ill try solve it soon(ish)
..
First, you should never claim something is faster without actually benchmarking it. Python has many hidden optimizations in built-in functions.
Second, I guess my solution would be faster in most cases because
any
stops at the firstTrue
, andall
stops at the firstFalse
, so it would only reach the end of the sequence if it consists of all equal elements. Your algorithm will reach the end in any case. Consider the situation[True, False, ...(10000 elements more)]
. My algorithm will stop after checking the first two elements; yours will check all the sequence in any case.On the second thought, it would be faster in any case except, maybe, some very short sequences, because the first value of predicate would be either
True
orFalse
, so one of theany
orall
functions is guaranteed to stop after checking it.For your solution, I missed the iterator part in map. yes, the space complexity will be O(1) but then it is a slower iteration over sequence. a simple loop should be faster. Mind me I understand that they both are O(n) time complexity but simple loop should be a faster O(n) out of those two. let me know what you think.
How is this:
Loading more items...