Problem 2149 · Medium

Rearrange Array Elements by Sign

Interleave positive and negative numbers so the signs alternate while each sign keeps its original order. The visual shows two queues being drawn from in turn to fill the output positions.

Open the interactive visualisation