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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It depends. If you want a O(1) space complexity, sorting is required. If you have extra space available, you can use my solution, which has a time complexity of O(a+b) as opposed to sorting's O(n log n) complexity.
This comment is hidden because it contains spoiler information about the solution
Yes, list comprehensions are considered to be more readable and thus preferable to using
filter()
andmap()
.For example, see http://stackoverflow.com/questions/5426754/google-python-style-guide
Also, iterations like
c for c in string
are preferable to using indexes likestring[i] for i in xrange(len(string))
.