MountainP
SRM 97 · 2002-06-12 · by brett1479
Problem Statement
To make a Mountain Palindrome from a given
Create a class MountainP that contains the method makeMP, which takes a
Notes
- Remember to append the FEWEST number of characters required to produce a palindrome.
Constraints
- before will have between 1 and 25 characters, inclusive.
- before will only contain capital letters ('A'-'Z').
"BEFORESTRING" Returns: "BEEFGINORRSTSRRONIGFEEB"
First we sort: "BEEFGINORRST" Next we append the fewest number of characters required to produce a palindrome.
"AZZAZ" Returns: "AAZZZAA"
First we sort: "AAZZZ" Next we append the fewest number of characters required to produce a palindrome.
"A" Returns: "A"
"TOPCODER" Returns: "CDEOOPRTRPOOEDC"
"GRRRRR" Returns: "GRRRRRG"
Submissions are judged against all 41 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class MountainP with a public method string makeMP(string before) · 41 test cases · 2 s / 256 MB per case