SQL SERVER solution beats 65%. Used LEAD(), DATEDIFF(), ROW_NUMBER()
Intuition\nFirstly, when I\'ve read next day log in, the first idea which came up was LEAD() OVER() partitioned by player_id. \nSecondly, we just need the first
# Intuition\nFirstly, when I\'ve read next day log in, the first idea which came up was LEAD() OVER() partitioned by player_id. \nSecondly, we just need the first day login so i\'ve added row_number() over() also partitioned by player_id and ordered by log in date.\n\n\n# Complexity\n- Time complexity:\nSo, I\'ve read two times activity table, so O(n^2)\n\n# Code\n```\nselect round(count(*)*1.0 / (select count(distinct player_id) from activity), 2) as fraction \nfrom\n(select\n    player_id,\n    event_date,\n    lead(event_date) over(partition by player_id order by event_date) as next_login,\n    row_number() over(partition by player_id order by event_date) as rn\nfrom activity) t\nwhere rn=1\nand DATEDIFF(day,event_date, coalesce(next_login, \'9999-12-31\'))=1\n```
['MS SQL Server']