Skip to content

Practice Classes With at Least 5 Students

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#596
LeetCode Problem

Classes With at Least 5 Students

Problem Statement

Tables: Courses(student VARCHAR, class VARCHAR). Courses has the composite key (student, class). Return each class with at least five enrolled students, in any order. Each student contributes once within a class because the enrollment pair is unique.

Source: Classes With at Least 5 Students on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Courses table: +---------+----------+ | student | class    | +---------+----------+ | A       | Math     | | B       | English  | | C       | Math     | | D       | Biology  | | E       | Math     | | F       | Computer | | G       | Math     | | H       | Math     | | I       | Math     | +---------+----------+
Output
+---------+ | class   | +---------+ | Math    | +---------+

Related LeetCode Problems

Practice more problems similar to Classes With at Least 5 Students.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.