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.
why have the and in there? if a == b, then b better dxmn well == a lmao
Because this solution is at least 5 years old and it wasn't revalidated.
xrange() was removed in Python 3, how this code passed the test?
Haha, skipped comparison with 'a'. And really, task restrictions says that string is always in range from 'a'.
This is me being pedantic, but xrange is removed in Python 3, not deprecated.
TIL xrange exists. That one's definitely getting some use.
Edit: Or not. Apparently, it's been deprecated in Python 3. Thankfully, range() works for this as well.
I'm not sure who is arguing that yours is less efficient. You have a redundant equality check but that would not amount to much. Superficially, I would guess the rest is the same but in general the Python core developers tend to internally optimize for Pythonic usages so, without testing, it's hard to know whether or not there is any advantage to using the accepted solution (I would guess there's a small advantage). The accepted solution is definitely a lot more Pythonic and more maintainable though.
This comment is hidden because it contains spoiler information about the solution
In Python3 range behaves as xrange did in Python2. https://stackoverflow.com/a/94962/2071807
isnt xrange for python2 ??
And I also learned that letters due to their unicode values can be useful in some situations. Thanks
I found this pretty clever guys.. :)
I don't even remember writing this but you guys are correct of course. That being said, there are plenty of other kata where honoring Gauss is required.
+1, simple math :P
This has cost O(n), you are actually adding each element one by one. There exists a close formula for this, so O(1) is possible.
Loading more items...