Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Keep track of the indices on both RLE arrays and join the parts together.
What is the maximum number of segments if we took the minimum number of elements left on both the current segments every time?