Level Combo Score Multiplier
Context
In a gaming challenge, each player has score bonuses recorded by level and move. A second record gives the matching multiplier for each position. Build the combined score record by multiplying values that occupy the same level and move position.
Problem
Implement a function that combines two nested integer sequences. Pair their outer lists in order, then pair entries within each corresponding inner list in order. For every aligned pair, place the product in the matching position of the result. Stop an outer pairing when either input has no more outer lists, and stop an inner pairing when either corresponding inner list has no more entries. Preserve the order and nested structure of all processed pairs, including empty inner lists. Negative values and zero are valid and must be handled by ordinary integer multiplication.
Examples
multipliers = [[10, 20, 30], [2, 4]]score_values = [[2, 4, 6], [3, 5]][[20, 80, 180], [6, 20]]multipliers = [[3, 4, 9], [], [6]]score_values = [[7, -2, 0], [], [5, 8]][[21, -8, 0], [], [30]]multipliers = [[10, 20], [2], [9], [8]]score_values = [[1, 2, 3], [4], [5, 6]][[10, 40], [8], [45]]Constraints
0 <= len(score_values) <= 400 <= len(score_values[i]) <= 40 for every i-1000000 <= score_values[i][j] <= 1000000 for every i, j0 <= len(multipliers) <= 400 <= len(multipliers[i]) <= 40 for every i-1000000 <= multipliers[i][j] <= 1000000 for every i, j- Types:
score_valuesis int[][],multipliersis int[][]; result is int[][]
Function signature
def combine_level_scores(score_values: list[list[int]], multipliers: list[list[int]]) -> list[list[int]]
score_valueslist[list[int]]- Nested integer values for each level and move.
multiplierslist[list[int]]- Nested integer multipliers aligned with the score values.
- returns list[list[int]]
- A nested integer sequence containing the products of aligned entries, with outer and inner pairing stopped at the shorter available sequence.
Adapted from MBPP problem task_445 (CC BY 4.0). Rewritten, extended and verified by Iksha.