Skip to content

Files

Latest commit

e936eb2 · May 18, 2022

History

History

Professor and Parties - GFG

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 18, 2022
May 18, 2022

Professor and Parties

Easy

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 ≤ 105
1 ≤ Ai ≤ 109