← 返回 amazon 的题目列表Repeat Customer Visits
类型:online_judge
amazon
Given a file containing logs, where each log has a timestamp and a customer, find the repeat customers who visited the website on multiple distinct days.
Requirements:
Implement a function to read and process these logs, identifying and returning all customers who visited the website more than once on different days.
Input:
A log file split by lines, each containing a timestamp and customer name.
The timestamp format: YYYY-MM-DD_HH:MM:SS, e.g., 2024-12-17_13:45:30
Line format e.g.: 2024-12-17_13:45:30,customer1
Output:
Return a list of strings listing all customer names who visited the website on more than one day.
Note:
Ensure that different day visits by the same customer name are only recorded once.
Different day is defined as different timestamps not on the same day.
Example:
Input:
[
"2024-12-17_13:45:30,customer1",
"2024-12-18_09:15:20,customer1",
"2024-12-17_08:00:00,customer2",
"2024-12-17_10:00:00,customer3",
"2024-12-18_10:00:00,customer2"
]
Output:
["customer1", "customer2"]
Constraints:
Total lines in logs do not exceed 100,000.
Each customer name does not exceed 256 characters.
Example
Input
["2024-12-17_13:45:30,customer1","2024-12-18_09:15:20,customer1","2024-12-17_08:00:00,customer2","2024-12-17_10:00:00,customer3","2024-12-18_10:00:00,customer2"]