Skip to content

Commit 021924c

Browse files
committed
Greedy
1 parent 4fc0248 commit 021924c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Algorithm/Greedy/beautifulPairs.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
n = int(raw_input())
2+
arrA = map(int,raw_input().split())
3+
arrB = map(int,raw_input().split())
4+
ans = 0
5+
for i in range(n):
6+
for j in range(len(arrB)):
7+
if arrA[i] == arrB[j]:
8+
arrB.pop(j)
9+
ans += 1
10+
break
11+
if ans == n:
12+
ans -= 1
13+
else:
14+
ans += 1
15+
16+
print ans

0 commit comments

Comments
 (0)