Searching for duplicates and matches is a favorite exercise for programmers. Let's do this: use the keyboard to read a list of 20 words and count how many identical words the list contains. We'll represent the result as a Map
, where the key is a unique string, and the value is the number of times this string occurs in the list.
Identical words in a list
You must be signed in to leave a comment
20 January 2021, 12:12
Is it just me, but I love lambda expressions and I keep complicating my life, trying to solve each challenge by using them... I solved this like this: for each string in the list, put in ( string, list filter if a word is equal to the string and count it. Download the solution: the most simple solution ever....why do I keep doing this to myself :D
9 January 2020, 19:41
Maybe its just my understanding, but "The case (uppercase/lowercase) affects the results." is not clear in my reading - affects but how? is "apple" and "Apple" are to be counted as one word or two? Anyway, I took it as separate and my solution was accepted.
5 May 2019, 17:54
micro bug in validation - the tests do not check how many words have been inserted to words array (it validates with eg 4 as well as with 20 words in the array .)