← 返回 oracle 的题目列表First Unique Login User
类型:online_judge
Implement a system to record user login behavior. There are two operations:
login(userId: int) -> None: Record the login of a user.
firstUser() -> int: Return the user ID of the first user who has logged in exactly once, or return -1 if no such user exists.
Constraints: All operations must have O(1) time complexity.
Example
Input
login(1)
login(2)
login(1)
firstUser()