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.
if you didn't change asciiValues, just change "var" to "let"
Yeah, you're right. I was tired yesterday xD I'm gonna do it, thank you very much :)
EDIT: I'm not allowed to delete this reply but it turned out to be in error. Let this edit remain here as a testament to my failure.
This comment is hidden because it contains spoiler information about the solution
Fixed.
Constants get elimitated in big-O notation O(3*n) is equivalent to O(n).
I believe your solution is O(n*3)
//first pass
for letter in word { .. }
//second pass
word.map {...}
//third pass
.joined()
I thought about their lengths, the wording of the task is still not self-evident. A poorly worded task.
You could for example think about their lengths.
It is not the author who gives the kyu but a moderator.
Once kata is approved and a rank is set, it can't be changed.
Your solution is actually an O(n^2) solution, due to the calls of firstIndex and lastIndex for each character. My solution is O(n) as it uses only constant time operations for each character. That doesn't really matter for smal examples like this, but for longer strings for larger alphabets, it will make a difference.