SimilarPairs
TCCC07 Sponsor 3 · 2007-07-30 · by Mike Mirzayanov
Problem Statement
You are given a
Constraints
- text will contain between 1 and 50 elements, inclusive.
- Each element of text will contain between 1 and 50 characters, inclusive.
- Each element of text will contain only lowercase letters ('a'..'z').
- k will be between 0 and 2500, inclusive.
{"abacd"}
1
Returns: 6
The following strings each belong to at least one similar pair: "a", "b", "c", "d", "ab", "ac".
{"aaaa"}
0
Returns: 2
{"abcdefgh"}
2
Returns: 15
{"a", "ab", "abc"}
0
Returns: 3
{"abacd"}
0
Returns: 1
Submissions are judged against all 229 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class SimilarPairs with a public method int howManyElements(vector<string> text, int k) · 229 test cases · 2 s / 256 MB per case