DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Repeat Visitor

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
L4

Problem

You're combing purchase logs for a retail loyalty team, where each record carries a `user` and a `date` string in 'YYYY-MM-DD' format and the records arrive in no particular order. A user counts as a repeat visitor if two of their purchases fall no more than `days` apart on the calendar. Return the IDs of those users sorted alphabetically, and an empty list when nobody qualifies.

Summary

Loyal customers come back sooner than expected.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons