We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
why no answer key?
import java.util.Arrays;
Arrays.stream(names).filter(x -> x.chars().filter(Character::isLetter).count() > 5).mapToInt(x -> x.length()).sum();
Am I the only one who can't run his code? I tried to run it on safari and chrome but the editor is stuck on "waiting" on both browsers
there was an issue with our infrastructure this weekend. It should be running smoothly now
I did Generics! Yaaay :) :)
Is this still accurate on codingame.com? I can't see the link to the GitHub...??
It would be better if you can add some basic example to explain the problem.
The questions say we have to find the total number of letters in all the names with more than 5 letters
Example:
List = {"orange", "apple", "watermelon", "melonbar", "monkeybar"}
the count of the words having letters more than 5 is four in the list i.e. orange, watermelon, melonbar, monkeybar.
OR
"the total number of letter in all the names with more than 5 letters" - will be total of the letters which exceeds 5 in all the names
e.g.
letters exceeding 5 in all string
orange = 2
apple = 0
watermelon = 5
melonbar = 3
monkeybar = 4
total = 2+0+5+3+4 = 14
Can you explain what exactly the question is about?
I think the question is to first filter out all the words that exceed 5 letters, then sum up the lengths of all such words.
In your above case, only the following names exceed 5 letters:
orange (length: 6)
watermelon (length: 10)
melonbar (length: 8)
monkeybar (length: 9)
So the final result will be: 6 + 10 + 8 + 9 = 33
This is a solution:return Arrays.stream(names).filter(s -> s.length() > 5).mapToInt(s -> s.length()).sum();
Très très intéressant comme entrainement .merci
There is a problem with the import of package, this work for me;
import java.util.stream.Collectors;