Coding Test

Leetcode - 574. Winning Candidate

Indo Yoon

문제

Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

정답

SELECT name
FROM Candidate
JOIN (
    SELECT candidateId, COUNT(candidateId) as votes
    FROM Vote
    GROUP BY candidateId
    ORDER BY votes DESC
    LIMIT 1 ) AS temp 
ON Candidate.id = temp.candidateId