Skip to content

Practice Game Play Analysis IV

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#550
LeetCode Problem

Game Play Analysis IV

Problem Statement

Tables: Activity(player_id INT, device_id INT, event_date DATE, games_played INT). Activity has the composite key (player_id, event_date). A login may record zero games. Return fraction: the number of players who logged in exactly one calendar day after their own first login divided by the total number of players. Round to two decimals. Later consecutive login pairs do not qualify unless the pair starts on that player's first login.

Source: Game Play Analysis IV on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Activity table: +-----------+-----------+------------+--------------+ | player_id | device_id | event_date | games_played | +-----------+-----------+------------+--------------+ | 1         | 2         | 2016-03-01 | 5            | | 1         | 2         | 2016-03-02 | 6            | | 2         | 3         | 2017-06-25 | 1            | | 3         | 1         | 2016-03-02 | 0            | | 3         | 4         | 2018-07-03 | 5            | +-----------+-----------+------------+--------------+
Output
+-----------+ | fraction  | +-----------+ | 0.33      | +-----------+

Related LeetCode Problems

Practice more problems similar to Game Play Analysis IV.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.