A professor went to a party. Being an erudite person, he classified the party into two categories. He proposed that if all the persons in the party are wearing different colored robes, then that is a girl’s only party. If we even get one duplicate color, it must be a boy’s party. The colors of the robes are represented by positive integers.
 
Example 1:
Input
N = 5
A[] = {1, 2, 3, 4, 7}
Output
GIRLS
Explanation:
All the colors are unique so it's a GIRLS party.
 
Example 2:
Input
N = 6
A[] = {1, 3, 2, 4, 5, 1}
Output
BOYS
Explanation:
There are two colors 1. So it's a BOYS party.
 
Your task:
You don't need to print the answer, printing is done by the driver code itself. You have to complete the function PartyType() which takes the array A[] and its size N as inputs and returns  “BOYS” (without quotes) if it’s a boy’s party, else returns “GIRLS”.
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
 
Constraints
1 ≤ N ≤ 10^{5}
1 ≤ A_{i }≤ 10^{9}

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: #User function Template for python3

class Solution:
    def PartyType(self, a, n):
        # Your code goes here

Solutions:
class Solution:

	def PartyType(self, a, n):
		set1 = set(a)
		if len(set1) == len(a):
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		mp = {}
		flag = 0
		for i in range(0, n):
			if mp.get(a[i]) == None:
				mp[a[i]] = 1
			else:
				flag = 1
		if flag == 1:
			return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		a.sort()
		count = 0
		if n <= 1:
			return 'GIRLS'
		for i in range(0, n):
			if a[i] == a[i - 1]:
				count += 1
		if count == 0:
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		d = {}
		for i in a:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
		for i in d:
			if d[i] > 1:
				return 'BOYS'
		return 'GIRLS'


from collections import Counter

class Solution:

	def PartyType(self, a, n):
		flag = True
		x = Counter(a)
		for i in Counter(x.values()):
			if i > 1:
				return 'BOYS'
				flag = False
		if flag == True:
			return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		dic = {}
		for i in a:
			if i in dic:
				dic[i] += 1
			else:
				dic[i] = 1
		for key in dic:
			if dic[key] > 1:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		b = set(a)
		c = list(b)
		if sum(c) == sum(a):
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		map = {}
		for i in range(len(a)):
			if a[i] in map:
				return 'BOYS'
			else:
				map[a[i]] = 1
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		s = set(a)
		l = len(s)
		if l == n:
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		m = {}
		for i in a:
			m[i] = m.get(i, 0) + 1
		for i in m.values():
			if i > 1:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		colorSet = set()
		for i in range(n):
			if a[i] in colorSet:
				return 'BOYS'
			else:
				colorSet.add(a[i])
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		freq = {}
		for i in range(n):
			if a[i] in freq:
				return 'BOYS'
			freq[a[i]] = 1
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		dict1 = {}
		for i in a:
			if i not in dict1:
				dict1[i] = 2
			else:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		x = set(a)
		if len(x) == len(a):
			return 'GIRLS'
		return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		robes = set()
		for num in a:
			if num in robes:
				return 'BOYS'
			else:
				robes.add(num)
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		arr = set()
		for i in a:
			if i in arr:
				return 'BOYS'
			arr.add(i)
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		color_set = set()
		for color in a:
			if color in color_set:
				return 'BOYS'
			else:
				color_set.add(color)
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		b = list(set(a))
		b.sort()
		d = {}
		for i in b:
			d[i] = 0
		for i in a:
			d[i] += 1
			if d[i] > 1:
				return 'BOYS'
		return 'GIRLS'


from collections import Counter

class Solution:

	def PartyType(self, a, n):
		c = Counter(a)
		for i in c.values():
			if i > 1:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		hashmap = {}
		for i in a:
			if i in hashmap:
				hashmap[i] += 1
			else:
				hashmap[i] = 1
		for (key, val) in hashmap.items():
			if val > 1:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		visited = set()
		for num in a:
			if num in visited:
				return 'BOYS'
			visited.add(num)
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		dic = {}
		for i in a:
			if i in dic:
				return 'BOYS'
			dic[i] = True
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		c = {'a', 'b'}
		for i in a:
			c.add(i)
		if len(c) - 2 == len(a):
			return 'GIRLS'
		return 'BOYS'


from collections import Counter

class Solution:

	def PartyType(self, a, n):
		cnt = Counter(a)
		cnt_keys = set([val for (key, val) in cnt.items()])
		if cnt_keys == {1}:
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		times = {}
		for num in a:
			if num not in times:
				times[num] = 1
			else:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		b = list(set(a))
		if len(a) == len(b):
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		arr = a.copy()
		arr = list(set(arr))
		if len(a) == len(arr):
			return 'GIRLS'
		else:
			return 'BOYS'


class Solution:

	def PartyType(self, a, n):
		equal_or_not = len(set(a)) != len(a)
		if equal_or_not == True:
			return 'BOYS'
		else:
			return 'GIRLS'


class Solution:

	def PartyType(self, arr, n):
		colors = {x: 0 for x in arr}
		for x in arr:
			colors[x] += 1
			if colors[x] > 1:
				return 'BOYS'
		return 'GIRLS'


class Solution:

	def PartyType(self, a, n):
		x = list(set(a))
		p = len(a)
		q = len(x)
		if p == q:
			return 'GIRLS'
		else:
			return 'BOYS'