#include "global.hpp" Response validate(vector sequence, vector guess) { int N = sequence.size(); // Return values int r_correct = 0; int r_somewhere = 0; // Find and remove correct values for(int i = 0; i < N; i++) { if(sequence[i] == guess[i]) { r_correct++; sequence[i] = -1; guess[i] = -1; } } // Find values that are there somewhere for(int col : guess) { if(col == -1) continue; for(int i = 0; i < N; i++) { if(sequence[i] == col) { r_somewhere++; sequence[i] = -1; break; } } } return {r_somewhere, r_correct}; }