숫자 게임
[3] 숫자 게임
#include #include #include using namespace std; int solution(vector A, vector B) { int answer = 0; sort(A.begin(),A.end()); sort(B.begin(),B.end()); int idxA=A.size()-1,idxB=B.size()-1; while(idxA >= 0) { int valA=A[idxA],valB=B[idxB]; if(valB > valA) { answer++; idxB--; } idxA--; } return answer; }