Easter eggs - 78B
Here is my solution: keeping in mind the main 2 conditions:
- Each color must bu used at least once.
- Every 4 successive colors must be different.
Firstly, we can consider the first 3 colors to be Red, Orange and Yellow for example.
The remaining 4 colors will be added after that depending on the number of eggs; suppose that our first string is "ROY", the second would be "GBIV"; we will print both strings firstly "ROYGBIV" and then add a character at a tim from the second string; this ensures that no 4 successive eggs have the same color.
Here is my C++ code: