Skip to content

Commit 7818174

Browse files
committed
Lv3_숫자게임
1 parent b672dbc commit 7818174

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <algorithm>
2+
#include <vector>
3+
using namespace std;
4+
5+
int solution105(vector<int> A, vector<int> B) {
6+
int answer = 0;
7+
sort(A.begin(), A.end());
8+
sort(B.begin(), B.end());
9+
int save = 0;
10+
11+
for (int i = 0; i < A.size(); i++) {
12+
for (int j = save; j < B.size(); j++) {
13+
if(A[i]<B[j]){
14+
answer++;
15+
save = j;
16+
save++;
17+
break;
18+
}
19+
}
20+
}
21+
return answer;
22+
}

0 commit comments

Comments
 (0)