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
very cool
How could you submit it, even though it fails for a negative first array?
damn two liners always looks good!!
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 has higher complexity. It sorts the list, so complexity is O(n log n), whereas if you use collections.Counter (a dict) it's (amortized) O(n), which is faster
Thank you! That's damn smart.
It checks if there is not a None inside the tuple (a1, a2) and return True if there is not and False if there is. Its just like (a1 != None and a2 != None)
could you explain the 'None not in'? Im not sure I fully grasp that.
this solution seems to break in one of my tests.
a1 = [121,None,144, 19,161,19,144,19,11]
a2 = [11 * 11, 121 * 121, 144 * 144, 19 * 19, 161 * 161, 19 * 19, 144 * 144, 19 * 19]
self.assertFalse(comp(a1,a2))
and
a1 = [121,144, 19,161,19,144,19,11]
a2 = [11 * 11, None]
self.assertFalse(comp(a1,a2))
This is so nice and clean.