Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2b8ee25

Browse files
no idea
1 parent 7f1f16f commit 2b8ee25

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

‎Hackerrank-Python3/no-idea.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@
22
n = int(n)
33
m = int(m)
44
narr = list(map(int, input().split()))
5-
marr1 = list(map(int, input().split()))
6-
marr2 = list(map(int, input().split()))
7-
inter_sec_happy = []
8-
inter_sec_happy = list(set(narr) & set(marr1))
9-
# print(inter_sec_happy)
10-
h = 0
11-
h = len(inter_sec_happy)
5+
marr1 = set(map(int, input().split()))
6+
marr2 = set(map(int, input().split()))
7+
h=0
8+
for i in narr:
9+
if i in marr1:
10+
h+=1
11+
if i in marr2:
12+
h-=1
13+
print(h)
1214

13-
inter_sec_sad = []
14-
inter_sec_sad = list(set(narr) & set(marr2))
15-
# print(inter_sec_sad)
16-
s = 0
17-
s = len(inter_sec_sad)
15+
#note: here marr1 and marr2 is not a list it's a set because while it was list the time taken by the compiler is much as compared to set in
1816

19-
happy = abs(h-s)
20-
21-
print(happy)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /