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.
Thanks for introducing me to the stream methods available, really nice pattern.
There's no need to compare with the empty string, since the outer loop will never be entered when str.length is 0 (becase 0 < 0 evaluates to false, the whole loop is skipped)
The issue with this code is you're returning 'true' before the outer loop has a chance to iterate, so you never compare the second letter with the rest of the string.
Move 'return true' down one line so it's the last thing that happens in the function and you will pass the tests without your str === ''
I was able to pass the tests from copy pasting your code so I can't speak to what the difference is, but I noticed you have a spurious global 'x' when you pass index + 1 to arrString.includes(). It works because the "x = index + 1" returns the new value of x, so its equiveleant to just "index + 1"
Nice, thank you for teaching me that there is a rotate function
is it best practice to assign variables like this, when i and ys are different data types? I guess I can get used to it but it was confusing to look at at first.
I like the use of slicing here in names[2:], I think it is more clear what you are counting then other solutions with len(names) - 2, which feels a little magic numbery.
I like the use of slicing here in names[2:], I think it is more clear what you are counting then other solutions with len(names) - 2, which feels a little magic numbery.
Good to know for/in works on strings, but performing regex is iterating over the whole string, so this becomes exponential time complexity.