Problem 2325. GJam 2014 Rd 1c: Reordering Train Cars (Large)
This Challenge is derived from GJam 2014 Rd 1c: Reordering Train Cars (Large).
Determine number of sequences for set of strings under the constraint that all same characters must be contiguous. The large case could have 26! or more permutations.
Input: s, string of N space separated string segments of letters [a..z]. 1<=N<=100. Total letters <=100.
Output: val, number of possible sequences, modulo 1,000,000,007
Example: Small Train Case examples
Theory: Train Small Spoilers
Large Case specific info. See Usage of java math for unlimited precision. Note intValue gives more precision than floatValue. No java factorial exists so a function, non-recursive, is suggested. The small solution can be converted via java BigInteger factorial, mod, multiply, and intValue to solve the large case.
Additional GJam solutions can be found at Example GJam Matlab solutions. Select Find Solutions, change Language to Matlab. The Test Suite, at the bottom, contains a full GJam Small Matlab solution. No Valid Matlab solutions were submitted during the contest.
Solution CommentsShow comments
Problem Recent Solvers2