The Wide View
A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L4
Problem
A reporting export arrives in long format: one record per cell, each carrying a `row` label, a `col` label, and a numeric `val`. Reshape it into a nested lookup keyed by row then column, so `result[row][col]` returns that cell's value. Rows are sparse, holding only the columns that actually appear for them, and when the same row and column pair shows up more than once the later record wins.
Summary
Long format is easy. Wide format is useful.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.