All problems

StreamVerse's Longest Single Sitting

easyPythonSorting

The content team at StreamVerse cuts a highlight reel for one genre at a time, and every reel opens with the show that hooked someone into the longest single viewing session in that genre — the caption quotes the number of minutes, so the length is part of the answer. It is deliberately not a question about which show racked up the most minutes overall; one uninterrupted sitting is the thing being celebrated, and a show watched in a dozen short bursts does not qualify however large its total.

Watch events

id subscriber_id show_id watch_minutes watch_date
1 1 1 45 2023-05-01
2 1 5 60 2023-05-03
3 2 3 20 2023-05-02
4 3 2 55 2023-05-05
5 4 1 40 2023-05-06
6 4 4 70 2023-05-08
7 1 3 25 2023-05-10
8 3 5 50 2023-05-11
9 2 2 30 2023-05-12
10 5 4 65 2023-05-14

Shows

id title genre release_year
1 Nebula Drift sci-fi 2021
2 The Long Kitchen drama 2019
3 Byte Size comedy 2022
4 Deep Trench documentary 2020
5 Neon Alley sci-fi 2023

Input

Both tables above are already built for you — those rows are not read from input. What does arrive is a single line naming the genre the reel is being cut for, spelled exactly as the genre column spells it.

Task: Print a Python dict with one entry: the title of the show involved in the single watch event with the highest watch_minutes among shows of that genre, mapped to that event's watch_minutes as a whole number. If nothing in that genre has ever been watched, print an empty dict.

Example: if one sitting beat everything else in its genre, the output would look like {'Some Show': 90}.

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…