Skip to content

Commit 3043731

Browse files
Create README - LeetHub
1 parent a5e8c3b commit 3043731

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Professor and Parties - GFG/README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Professor and Parties
2+
## Easy
3+
<div class="problem-statement">
4+
<p></p><p><span style="font-size:18px">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.</span></p>
5+
6+
<p>&nbsp;</p>
7+
8+
<p><span style="font-size:18px"><strong>Example</strong> <strong>1:</strong></span></p>
9+
10+
<pre><span style="font-size:18px"><strong>Input</strong>
11+
N = 5
12+
A[] = {1, 2, 3, 4, 7}
13+
<strong>Output</strong>
14+
GIRLS
15+
<strong>Explanation:</strong>
16+
All the colors are unique so it's a GIRLS party.</span></pre>
17+
18+
<p>&nbsp;</p>
19+
20+
<p><span style="font-size:18px"><strong>Example</strong> <strong>2:</strong></span></p>
21+
22+
<pre><span style="font-size:18px"><strong>Input</strong>
23+
N = 6
24+
A[] = {1, 3, 2, 4, 5, 1}
25+
<strong>Output</strong>
26+
BOYS
27+
<strong>Explanation:</strong>
28+
There are two colors 1. So it's a BOYS party.
29+
</span></pre>
30+
31+
<p>&nbsp;</p>
32+
33+
<p><br>
34+
<span style="font-size:18px"><strong>Your task:</strong><br>
35+
You <strong>don't</strong> need to print the answer, printing is done by the driver code itself. You have to complete the function <strong>PartyType()</strong> which takes the array <strong>A[]</strong> and its size <strong>N</strong><strong> </strong>as inputs and returns&nbsp; “<strong>BOYS</strong>” (without quotes) if it’s a boy’s party, else returns “<strong>GIRLS</strong>”.</span></p>
36+
37+
<p>&nbsp;</p>
38+
39+
<p><span style="font-size:18px"><strong>Expected Time Complexity: </strong>O(N)<br>
40+
<strong>Expected Auxiliary Space: </strong>O(N)</span></p>
41+
42+
<p>&nbsp;</p>
43+
44+
<p><span style="font-size:18px"><strong>Constraints</strong><br>
45+
1 ≤ N ≤ 10<sup>5</sup><br>
46+
1 ≤ A<sub>i </sub>≤ 10<sup>9</sup></span></p>
47+
<p></p>
48+
</div>

0 commit comments

Comments
 (0)