We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def happiness_1(n,m,my_array,my_a,my_b):
happiness=0
for num in my_array:
if num in my_a:
happiness += 1
elif num in my_b:
happiness -= 1
return happiness
print(happiness_1(n,m,my_array,my_a,my_b))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
No Idea!
You are viewing a single comment's thread. Return to all comments →
n,m =map(int,input().split()) my_array =map(int,input().split()) my_a=set(map(int,input().split())) my_b=set(map(int,input().split()))
def happiness_1(n,m,my_array,my_a,my_b): happiness=0 for num in my_array: if num in my_a: happiness += 1 elif num in my_b: happiness -= 1 return happiness
print(happiness_1(n,m,my_array,my_a,my_b))