Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Code owners
.github/CODEOWNERS @exercism/maintainers-admin

# The code sample shown in the code check when people sign up to Exercism
docs/SIGN_UP_SNIPPET.txt @exercism/maintainers-admin

# Changes to `fetch-configlet` should be made in the `exercism/configlet` repo
bin/fetch-configlet @exercism/maintainers-admin

12 changes: 12 additions & 0 deletions docs/SIGN_UP_SNIPPET.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public static String mostCommonWord(String text) {
Map<String, Integer> counts = new HashMap<>();
String best = "";
for (String word : text.toLowerCase().split(" ")) {
int count = counts.getOrDefault(word, 0) + 1;
counts.put(word, count);
if (count > counts.getOrDefault(best, 0)) {
best = word;
}
}
return String.format("\"%s\" appears %d times", best, counts.get(best));
}
Loading