PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/Netflix

Transform flat keys into nested dictionary

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in parsing and restructuring hierarchical parameter keys into nested dictionary structures, string manipulation for grouping, handling nonconforming keys and duplicates, and reasoning about time and space complexity.

  • Medium
  • Netflix
  • Data Manipulation (SQL/Python)
  • Machine Learning Engineer

Transform flat keys into nested dictionary

Company: Netflix

Role: Machine Learning Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

You are given a flat collection of parameter keys like ['layer1.attention.q_proj.weight', 'layer1.attention.k_proj.weight', 'layer1.mlp.fc1.weight', ...]. Write a Python function that converts this into a nested dictionary grouped by layer index, placing entries that share the same component path under the same layer (e.g., attention, mlp). Define your grouping rule (e.g., strip the 'layer{n}.' prefix to identify similar components), handle nonconforming keys and duplicates, and analyze time and space complexity.

Quick Answer: This question evaluates proficiency in parsing and restructuring hierarchical parameter keys into nested dictionary structures, string manipulation for grouping, handling nonconforming keys and duplicates, and reasoning about time and space complexity.

Related Interview Questions

  • Aggregate D1 retention cohorts in SQL - Netflix (Medium)
  • Write SQL for DAU and first-purchase conversion - Netflix (Medium)
  • Write SQL for rolling frequency caps - Netflix (Medium)
  • Analyze Retention Metrics Using SQL and Python - Netflix (Medium)
  • Determine Maximum Consecutive Order Days Per User - Netflix (Medium)
Netflix logo
Netflix
Aug 13, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Data Manipulation (SQL/Python)
3
0

You are given a flat collection of parameter keys like ['layer1.attention.q_proj.weight', 'layer1.attention.k_proj.weight', 'layer1.mlp.fc1.weight', ...]. Write a Python function that converts this into a nested dictionary grouped by layer index, placing entries that share the same component path under the same layer (e.g., attention, mlp). Define your grouping rule (e.g., strip the 'layer{n}.' prefix to identify similar components), handle nonconforming keys and duplicates, and analyze time and space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Netflix•More Machine Learning Engineer•Netflix Machine Learning Engineer•Netflix Data Manipulation (SQL/Python)•Machine Learning Engineer Data Manipulation (SQL/Python)
PracHub

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

Product

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

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL 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.