Rearrange Positive Negative Problem

Rearrange Positive Negative Problem — ExecCode Easy DSA Practice

Solve the Rearrange Positive Negative problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Rearrange Positive Negative. Your task is to count line (may be ignored), then space-separated nums. A sequence of values is given, and order matters. In Rearrange Positive Negative, the goal is to transform, count, or select values according to the exact rule. Return rearranged values space-separated.

Examples

Input {"nums": [1, 2, 3, -4, -1, 4]}; Output 1 -4 2 -1 3 4

Constraints

Preserve relative order within sign groups

Practice Rearrange Positive Negative free on ExecCode. Browse DSA problems, topic map, and placement guides.