We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

gabrielaramburu • 2 years ago

There is a problem with the import of package, this work for me;

import java.util.stream.Collectors;

KarterFX • 1 year ago

why no answer key?

Anonymous • 1 year ago

import java.util.Arrays;
Arrays.stream(names).filter(x -> x.chars().filter(Character::isLetter).count() > 5).mapToInt(x -> x.length()).sum();

BassamElKhoury • 2 years ago

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

[CG]Thibaud • 2 years ago

there was an issue with our infrastructure this weekend. It should be running smoothly now

masxa • 2 years ago

I did Generics! Yaaay :) :)

ChrisBamberry • 3 years ago

Is this still accurate on codingame.com? I can't see the link to the GitHub...??

Luc Chauvet • 3 years ago
Ashutosh Sharma • 3 years ago

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

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.


"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
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?

Samuel Tan • 3 years ago

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();

Anonymous • 4 years ago

Très très intéressant comme entrainement .merci