SymmetricImage
TCO18 India Fun · 2018-04-20 · by erinn
Problem Statement
You are given an image described in
Constraints
- image will contain between 1 and 50 elements, inclusive.
- Each element of image will contain between 1 and 50 characters, inclusive.
- Each element of image will be the same length.
- Each character of each element of image will be an uppercase letter ('A'-'Z').
{ "AAA",
"BBB" }
Returns: 1
The image is symmetric horizontally, but not vertically.
{ "ABCDE",
"ABCDE",
"ABCDE" }
Returns: 1
Here we have vertical symmetry only.
{ "ABA",
"CDC",
"ABA" }
Returns: 2
Symmetry in both directions.
{ "ABC" }
Returns: 1
With only a single row of pixels, we are guaranteed vertical symmetry.
{ "AB",
"CD" }
Returns: 0
No symmetry at all.
Submissions are judged against all 18 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class SymmetricImage with a public method int countDirections(vector<string> image) · 18 test cases · 2 s / 256 MB per case