Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
620 B
1
Indexable
string solution(vector<string> &A) {
    for(int i = 0; i <= 6; ++i) {
        for(int j = i; j <= 6; ++j) {
            std::string domino = std::to_string(i) + "-" + std::to_string(j);
            auto element = std::find(A.begin(), A.end(), domino);
            if(element == A.end()) {
                std::string reversedDomino = std::to_string(j) + "-" + std::to_string(i);
                auto reversedElement = std::find(A.begin(), A.end(), reversedDomino);
                if(reversedDomino == A.end()) {
                    return reversedDomino;
                }
            }
        }
    }
}