PracHub
QuestionsLearningGuidesInterview Prep

Quick Overview

This question evaluates in-memory data modeling, search and aggregation over structured records, case-insensitive string handling, and counting unique platform entries.

  • hard
  • Discord
  • Coding & Algorithms
  • Data Engineer

Implement Game Metadata Lookups

Company: Discord

Role: Data Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Onsite

You are given a list of game metadata records. Build an in-memory representation that can store each game's name, release date, platforms, genre, publisher, optional country, and relevant Discord servers. Then implement lookup functions over the data. Example input: ```python games = [ { "name": "Cyber Quest", "release_date": "2025-01-01", "platform": ["playstation", "xbox"], "genre": "RPG", "publisher": "GameStudio A" }, { "name": "Battle Arena", "release_date": "2024-11-15", "platform": ["pc"], "genre": "Action", "publisher": "GameStudio B" }, { "name": "Sky Adventure", "release_date": "2025-02-10", "platform": ["playstation"], "genre": "Adventure", "publisher": "GameStudio A" }, { "name": "Mystery World", "release_date": "2023-07-20", "platform": ["xbox", "pc"], "genre": "Puzzle", "publisher": "GameStudio C" }, { "name": "Speed Racer", "release_date": "2025-03-05", "platform": ["pc", "playstation"], "genre": "Racing", "publisher": "GameStudio B" } ] ``` Implement the following functions: ```python def get_genre(input_game): """Given a game name, return the genre of that game. Return None if not found.""" return None def get_games(input_genre): """Given a genre, return a list of game names with that genre.""" result = [] return result def get_most_available_games(games): """Return all game names that are available on the largest number of unique platforms.""" result = [] return result def get_available_games(number_of_platform): """Return all game names that are available on exactly number_of_platform unique platforms.""" result = [] return result ``` Requirements: - Treat game-name and genre lookups as case-insensitive. - Count unique platforms for each game. - If multiple games tie for the largest number of platforms, return all of them. - Preserve the original game names in returned results.

Quick Answer: This question evaluates in-memory data modeling, search and aggregation over structured records, case-insensitive string handling, and counting unique platform entries.

You are given a list of game metadata records and a list of lookup queries. Each game record contains a name, release date, platform list, genre, publisher, and may also contain optional fields such as country and discord_servers. Build an efficient in-memory representation and answer each query. Game-name and genre lookups are case-insensitive, but returned game names must preserve their original casing. When counting platforms, count only unique platform strings for each game. Return query results in the same order as the queries.

Constraints

  • 0 <= len(games) <= 100000
  • 0 <= len(queries) <= 100000
  • Each game name is unique case-insensitively
  • Each game record contains at least: name, release_date, platform, genre, and publisher
  • platform is a list of strings and may contain duplicates
  • Returned game-name lists must preserve the order in which games appeared in the input

Examples

Input: ([{'name': 'Cyber Quest', 'release_date': '2025-01-01', 'platform': ['playstation', 'xbox'], 'genre': 'RPG', 'publisher': 'GameStudio A'}, {'name': 'Battle Arena', 'release_date': '2024-11-15', 'platform': ['pc'], 'genre': 'Action', 'publisher': 'GameStudio B'}, {'name': 'Sky Adventure', 'release_date': '2025-02-10', 'platform': ['playstation'], 'genre': 'Adventure', 'publisher': 'GameStudio A'}, {'name': 'Mystery World', 'release_date': '2023-07-20', 'platform': ['xbox', 'pc'], 'genre': 'Puzzle', 'publisher': 'GameStudio C'}, {'name': 'Speed Racer', 'release_date': '2025-03-05', 'platform': ['pc', 'playstation'], 'genre': 'Racing', 'publisher': 'GameStudio B'}], [('get_genre', 'cyber quest'), ('get_games', 'rpg'), ('get_games', 'ACTION'), ('get_most_available_games',), ('get_available_games', 1), ('get_genre', 'Unknown Game')])

Expected Output: ['RPG', ['Cyber Quest'], ['Battle Arena'], ['Cyber Quest', 'Mystery World', 'Speed Racer'], ['Battle Arena', 'Sky Adventure'], None]

Explanation: Lookups are case-insensitive. Three games have the maximum of 2 unique platforms. Battle Arena and Sky Adventure are each available on exactly 1 unique platform.

Input: ([{'name': 'Echo Drift', 'release_date': '2024-01-01', 'platform': ['pc', 'pc', 'xbox'], 'genre': 'Racing', 'publisher': 'Studio One', 'country': 'US', 'discord_servers': ['echo-hub']}, {'name': 'Puzzle Box', 'release_date': '2024-02-01', 'platform': ['switch'], 'genre': 'Puzzle', 'publisher': 'Studio Two'}, {'name': 'Silent Echo', 'release_date': '2024-03-01', 'platform': ['pc', 'xbox'], 'genre': 'racing', 'publisher': 'Studio Three'}], [('get_available_games', 2), ('get_most_available_games',), ('get_games', 'RACING'), ('get_genre', 'silent echo')])

Expected Output: [['Echo Drift', 'Silent Echo'], ['Echo Drift', 'Silent Echo'], ['Echo Drift', 'Silent Echo'], 'racing']

Explanation: Duplicate platforms are counted once, so Echo Drift has 2 unique platforms. Genre lookup for RACING matches both Racing and racing.

Hints

  1. Build dictionaries keyed by lowercased or casefolded names and genres so lookups are O(1) on average.
  2. Precompute each game's unique platform count once, then index games by that count and track the maximum count.
Last updated: Jul 5, 2026

Related Coding Questions

  • Implement User Sessionization From Event Stream - Discord (hard)
  • Implement an asyncio-based chat server - Discord (medium)

Loading coding console...

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.