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.
Well done JorgeAbad! You are quite the peristent character, a very good trait to have in programming. Good work mate.
Object key-value. I don't want to spoil too much, but think of a way to only run once over each string.
Look at your strings. Lets say str1 is 'abcde' and str2 is 'cab'. In order to see if this will return true, you need at least 1 'c', 1 'a' and 1 'b'. Determine using the other str if you have those amounts.
The answer is no. It's easier than that. Try using an object.
There are 50 random tests with string lengths between 0 and 500 and then 4 performance tests with string lengths of 500 000
Hi JorgeAbad. Array functions are usually O(n), which basically means that it will run through every element that exists in it, it's a hidden
for
loop. So if you have code for exmaple like this:That is 2 nested loops, even tho you explicitly only created one, which could blow up your execution time. So just be wary of these "hidden" loops inside array functions,
As long as you use 2 nested loops it won't work. Your code should be faster than that.
That's the reason for both this kata being 5kyu and this note: Performance needs to be considered
Yes, that's not fast enough, you have to find a better solution.