Kotlinlearncs.online LogoJava
Return to List

Solve: Count Repeated Words With Map Case-Insensitive

Created By: Pranav Narayanan
/ Version: 2025.2.1

Declare and complete a method named countRepeatedWords that, given a List<String>, returns a count of how many Strings appear more than once in the List as an int. You should complete this problem with a Map, and not use a nested loop.

For example, given the list {"one", "two", "four"}, you would return 0, since no words appear more than once. Given the list {"two", "two", "five"}, you would return 1.

This should be a case-insensitive comparison. For example, given the list {"two", "TwO", "five"}, you would return 1, since "two" and "TwO" are the same when being case-insensitive.

Adapted from Count Repeated Words HW problem.

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/kotlin/count-repeated-words-with-map-case-insensitive/[email protected]