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
look at the tests
You need
chars()
to safely iterate UTF characters of astr
. Strings are always UTF-8 encoded, so accessing the bytes directly would be problematic. Thecollect()
at the end consumes theIterator
into aString
.For better functional composition, a more flexible signature would be:
This way you could pass any iterable into the function (including
str.chars()
), and chain the function lazily, without allocating a String for output.I believe in you, WarriorZero
I suggest to generate the first 10..20 elements or so with your code, and then examine it. You may notice a certain pattern... If so, try to make use of it somehow.
Cheers
This is an algorithm kata. So an efficient algorithm is required.
From the looks of it, it suggests nothing but that you're simply not capable enough for this kata.
My only suggestion is that you shouldn't be attempting this kata in the first place (because of the huge skill mismatch), and you should go try something else.
I'm afraid you might really need to train your reading comprehension skills before training on more katas.
The descriptions are perfectly clear for the rest of the people, so it's just you.
look at the examples!
pos = positions / peak = value