2041. The Latest Login in 2020
My accepted SQL solution to LeetCode problem 2041, The Latest Login in 2020, running in 541ms.
- Difficulty: Easy
- SQL
- Runtime 541ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 541ms, memory 0.0B, accepted 2025-12-31.
SELECT user_id, MAX(time_stamp) AS last_stamp
FROM Logins
WHERE YEAR(time_stamp) = 2020
GROUP BY user_id