0
Leetcode Problem 2072. The Winner University
2072. The Winner University
AI Mock Interview
Leetcode Solutions
Counting Excellent Students and Comparing Totals
Solution Idea
Query Steps
Code Implementation
Use a subquery to count the number of excellent students from New York University.
Use another subquery to count the number of excellent students from California University.
Use a CASE statement to compare the counts from the two subqueries.
If New York's count is greater, return 'New York University'.
If California's count is greater, return 'California University'.
If the counts are equal, return 'No Winner'.
Select the result of the CASE statement as the 'winner'.
erDiagram NewYork { int student_id PK int score } California { int student_id PK int score }
Using Common Table Expressions (CTEs) to Count Excellent Students
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...