In this

**HackerRank No Idea! problem solution**There is an array of n integers. There are also 2 disjoint sets, A and B, each containing m integers. You like all the integers in set A and dislike all the integers in set B. Your initial happiness is 0. For each i integer in the array, if i belongs to A, you add 1 to your happiness. If i belongs to B, you add -1 to your happiness. Otherwise, your happiness does not change. Output your final happiness at the end.## HackerRank No Idea! problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT n, m = map(int, raw_input().strip().split()) numbers = map(int, raw_input().strip().split()) A = set(map(int, raw_input().strip().split())) B = set(map(int, raw_input().strip().split())) happiness = 0 for num in numbers: if num in A: happiness += 1 if num in B: happiness -= 1 print(happiness)

## 0 Comments