Identify Users with Specific Page Navigation Patterns
Company: PayPal
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates a data scientist's competency in SQL-based sequence detection, temporal filtering, and aggregation to identify repeated navigation patterns within user-day sessions.
Tables
page_visits(visit_date DATE, user_id INTEGER, page_id VARCHAR(10), ts TIMESTAMP)
Hints
- Order events by ts and use LAG(page_id) over (PARTITION BY user_id, visit_date ORDER BY ts) to detect A→B transitions.
- Aggregate per user_id and visit_date, filter out days containing page 'C', and keep only those with more than one A→B transition; then select distinct user_id.