Problem Statement | |||||||||||||
| The similarity of two words is the number of letters they share in common. Letter comparisons are case insensitive, and each occurrence of a letter counts only once. More precisely, if the same letter appears k times in the first word and m times in the second word, then this letter contributes minimum(k, m) to the similarity (see example 0 for clarification). You are given a String[] words, each element of which is a single word. Find a pair of words among them with the greatest similarity and return that similarity. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
| - | words will contain between 2 and 50 elements, inclusive. | ||||||||||||
| - | Each element of words will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each element of words will contain only letters ('a'-'z', 'A'-'Z'). | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||