Connection Status:
Competition Arena > ColorWheel
Rookie SRM 1 · 2020-11-13 · by erinn · Brute Force
Class Name: ColorWheel
Return Type: String
Method Name: describePair
Arg Types: (string, string)
Problem Statement

Problem Statement

In art, the color wheel is a concept that divides color into three primary colors, with three secondary colors between them, creating a wheel of six colors:

The colors are Red, Orange, Yellow, Green, Blue, and Purple, in that order.

Two colors can be "Adjacent", if they're next to each other on the color wheel. They can also be "Complementary" if they're opposite each other on the color wheel.

Given two color names, color1 and color2, return "Same" if they are the same, "Adjacent" if they are adjacent, "Complementary" if they're opposite, or "None" if they are none of these.

Constraints

  • color1 and color2 will each be one of the six listed colors.
Examples
0)
"Red"
"Green"
Returns: "Complementary"

These are across from each other.

1)
"Red"
"Purple"
Returns: "Adjacent"

Since the wheel wraps around in a circular fashion, these are, of course, next to each other.

2)
"Orange"
"Orange"
Returns: "Same"
3)
"Yellow"
"Blue"
Returns: "None"
4)
"Green"
"Blue"
Returns: "Adjacent"

Submissions are judged against all 19 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class ColorWheel with a public method string describePair(string color1, string color2) · 19 test cases · 2 s / 256 MB per case

Submitting as anonymous