WhatsApp Image 2024-07-10 at 23.20.48_dd4394bd.jpg

Untitled

solution

#include <iostream>
#include <vector>
using namespace std;
int solution(vector<string> &A) {
    int RR = 0, GG = 0, RG = 0, GR = 0;
    for (string &s : A) {
        if (s == "RR") RR++;
        else if (s == "GG") GG++;
        else if (s == "RG") RG++;
        else GR++;
    }
    
    if (RG || GR)
        return RR + GG + 2 * min(RG, GR) + (RG != GR);
    else
        return max(RR, GG);
} TASK 1

Untitled

WhatsApp Image 2024-07-10 at 23.20.49_89b61b94.jpg

Another slot

1st question

Untitled

Untitled

Untitled

Untitled

2nd question

Untitled

Untitled

Another slot

1st Question

Untitled

Untitled

Untitled