You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2><ahref="https://leetcode.com/problems/classes-more-than-5-students">Classes More Than 5 Students</a></h2> <imgsrc='https://img.shields.io/badge/Difficulty-Easy-brightgreen'alt='Difficulty: Easy' /><hr><p>Table: <code>Courses</code></p>
2
+
3
+
<pre>
4
+
+-------------+---------+
5
+
| Column Name | Type |
6
+
+-------------+---------+
7
+
| student | varchar |
8
+
| class | varchar |
9
+
+-------------+---------+
10
+
(student, class) is the primary key (combination of columns with unique values) for this table.
11
+
Each row of this table indicates the name of a student and the class in which they are enrolled.
12
+
</pre>
13
+
14
+
<p> </p>
15
+
16
+
<p>Write a solution to find all the classes that have <strong>at least five students</strong>.</p>
17
+
18
+
<p>Return the result table in <strong>any order</strong>.</p>
19
+
20
+
<p>The result format is in the following example.</p>
21
+
22
+
<p> </p>
23
+
<p><strongclass="example">Example 1:</strong></p>
24
+
25
+
<pre>
26
+
<strong>Input:</strong>
27
+
Courses table:
28
+
+---------+----------+
29
+
| student | class |
30
+
+---------+----------+
31
+
| A | Math |
32
+
| B | English |
33
+
| C | Math |
34
+
| D | Biology |
35
+
| E | Math |
36
+
| F | Computer |
37
+
| G | Math |
38
+
| H | Math |
39
+
| I | Math |
40
+
+---------+----------+
41
+
<strong>Output:</strong>
42
+
+---------+
43
+
| class |
44
+
+---------+
45
+
| Math |
46
+
+---------+
47
+
<strong>Explanation:</strong>
48
+
- Math has 6 students, so we include it.
49
+
- English has 1 student, so we do not include it.
50
+
- Biology has 1 student, so we do not include it.
51
+
- Computer has 1 student, so we do not include it.
0 commit comments