Problem Statement | |||||||||||||
Given a collection of n strings, there are n! ways to concatenate them into a
single string. Create a class LongestRun that contains method runLength that
takes a String[] collection as input and returns the length of the longest run
that can be formed by concatenating the strings.
A run is a sequence of adjacent identical characters. For example, "CACAAABBQ" contains a run of 2 B's and a run of 3 A's (as well as four other runs of length 1). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | collection contains between 1 and 50 elements inclusive | ||||||||||||
- | each element of collection contains between 1 and 50 characters inclusive | ||||||||||||
- | each element of collection contains only uppercase letters, 'A'-'Z' | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|