Skip to main content

Challenge #1: Modify a table data

·108 words·1 min

🧩 Challenge: Normalize table row lengths 🐍 Language: Python

📋 Problem
#

Given a structure that represents a data table:

[
 [foo:42, baz:7],
 [foo:45, bar:8, baz:9],
]

N rows, M items in a row, an item is <label>:<value>

Return a new structure with null values for items with no label — ensuring constant row length.

✅ Expected Output
#

[
    [foo:42, bar:7, baz:null],
    [foo:45, bar:8, baz:9],
]

🔁 Edge Case: Repeating Labels
#

Labels can repeat arbitrarily:

[
    [foo:42, foo:99, bar:7, foo:77],
    [foo:45, baz:9, baz:9, bar:8, baz:9, baz:10],
]

The order of labels in the output can be arbitrary.

⚠️ Limitations
#

N < 10^6, M < 10^6