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.
Using count? It happens to loop for every element in set, through whole list. In case of multiples dictionary or counter should be used, and there is no other optimal way around, just to iterate over list once.
using .count in set(arr1) and set(arr2) can be quicker, especially when there is a lot of replicate number in long lists.
would not count method run big O of n times?
can you explain why this works?
why is this under dynamic programming?
Normally "clearly said..." is not enough, you should know this:-)... Often the first step solving a kata is to check the easiest way and not to find a more difficult solution;-)...
Clearly said not to use str and still this answer gets the most upvotes. Ironic.
python
ya true. For each element we have to run through the other array.
This comment is hidden because it contains spoiler information about the solution
How about checking if each element of arr1 has a square in arr2 and each element has a sqrt in arr1? This is big O of n where as sorting is at best nlogn
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution