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.
cool)))
Readable, close to what I did. I like it.
or extract "pure" factorial method, which can be made recursive
Don't you create two string objects each iteration?
Then why is this best practice?
It's still O(n).
It's fine! Learning is what's important :)
Thanks @Kacarott, I really didn't know. Thanks for that lesson.
@geans You are overlooking one important thing.
map
does NOT go through the whole list. It creates a generator, which produces values one at a time, which feeds into the other functions, which short circuit.Here is proof:
man, just read my comment again: there is no difference in the present context...
:/
I believe that what @Ivry wrote is still valid, as this solution goes through the list twice because of the
map
(imagine a big list), however the problem can be solved in the first two items in case: one is True and the other False.So it's not "the best" practice. I mark as cleaver.
Okay, so I am going to take a chance here and ask, does this method have any advantage... or the opposite?
oh, yes :) thx, I got your point
@Ivry: you're comparing
O(2*n)
andO(n*2)
, saying they are different. They aren't.See above.
How is that best if it runs through sequence twice?
Loading more items...