Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try to find a tile that has the same color as its next tile (if it exists).
Then try to find maximal alternating groups by starting a single for loop from that tile.
Solve with full IDE support and test cases