Programmers 12987
숫자 게임


CODE ⌨️

#include <vector>
#include <algorithm>

using namespace std;

int solution(vector<int> A, vector<int> B)
{
	int answer = 0;

	sort(A.begin(), A.end(), less<int>());
	sort(B.begin(), B.end(), less<int>());

	int aidx = A.size() - 1;
	int bidx = B.size() - 1;

	while (true)
	{
		if (aidx < 0) break;

		if (A[aidx] < B[bidx])
		{
			answer++;
			bidx--;
		}

		aidx--;
	}

	return answer;
}



RESULT 💛



SIMPLE DISCUSSION ✏️

구현 관련 문제였다.



SOURCE 💎

Programmers_Link 👈 Click here


*****
NOT A TALENT ❎ NOT GIVING UP ✅
CopyRight ⓒ 2022 DCherish All Rights Reserved.