[value, count] means the number value appears count times in a row. For example, [[7, 2], [4, 3]] stands for [7, 7, 4, 4, 4].
You are given two compressed sequences, first and second. Once expanded, they have the same length. Multiply them element by element (the i-th by the i-th) and return the result, compressed as well.
The compression must be as short as possible: two neighbouring pieces with the same value are merged into one.
Avoid expanding the sequences in full, since they can get very long.first=[[2, 4]], second=[[3, 1], [5, 3]] → [[6, 1], [10, 3]]
Expanded: [2, 2, 2, 2] and [3, 5, 5, 5]. The products are [6, 10, 10, 10]: one 6 followed by three 10s.
first=[[1, 2], [3, 2]], second=[[6, 2], [2, 2]] → [[6, 4]]
The result is [6, 6, 6, 6]. Equal neighbouring pieces must be merged into one: [[6, 4]], not [[6, 2], [6, 2]].
[value, count] with 1 ≤ value, count ≤ 10⁴first=[[2, 4]], second=[[3, 1], [5, 3]]
[[6, 1], [10, 3]]
Run checks the first 3 tests in your browser. Submit checks all 100 tests on the server, hidden ones included.