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
Thought of the same solution haha. Also pondered over the "hint" in the description.
For Python 3, simply use integer divide for every divsion instead (change
/
to//
). This eliminates having to explicitly cast the results to int.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 believe you might've mistaken this as another problem? We are dealing with any number of integers inside the arrays, not letters. The worst case would be being given large arrays of all unqiue integers, resulting in O(n) extra space.
Of course, this is still better than sorting as it saves on time complexity (O(n) as opposed to O(nlogn)).
This comment is hidden because it contains spoiler information about the solution
I believe the
i
inint i = 0
should be declared as along
instead. Ifn
is actually a long value,i
will overflow. An alternative would be to use a while loop and decrementn
.That's exactly what an anagram is: different rearrangement of the same letters.
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
This comment is hidden because it contains spoiler information about the solution