LeetCode solutions

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

Read the problem on LeetCode View on GitHub

SQL

Accepted on LeetCode — runtime 541ms, memory 0.0B, accepted 2025-12-31.

sql
SELECT user_id, MAX(time_stamp) AS last_stamp
FROM Logins
WHERE YEAR(time_stamp) = 2020
GROUP BY user_id

Source