I have a vector of say 8 numbers $x_1$ = [0 0 0 0 0 0 0 0].
I have information LEFT = [6L 2L] which means the the 6 most leftmost elements are to increase by 1, and then the 2 leftmost elements are to increase again by 1. Now $x_2$ = [2 2 1 1 1 1 0 0].
Also I have the information RIGHT = [7R 5R 3R 1R] which modifies the vector $x_2$ for the rightmost values giving the vector $x_3$ = [2 3 2 3 3 4 3 4].
Now as the order of the final answer is irrelevant I can represent the final series $x_3$ equivalently in descending order as $x_e$ = [4 4 3 3 3 3 2 2]. This means I could have used the equivalent modifying operations EQUIV = [8L 8L 6L 2L] directly on $x_1$.
My question is, how can I most efficiantly using LEFT and RIGHT and knowing the length of $x_1$, find EQUIV?