You are given an integer array actions, where each number is the ID of a training project.

The goal is to rearrange the array so that all odd numbers come before all even numbers.

Return the adjusted array.

Example 1

Input:  [1,2,3,4,5]
Output: [1,3,5,2,4]

Constraints


Solution (In-Place Two-Pointer)

We want all odds on the left side and all evens on the right side.

Use two pointers:

Steps:

  1. If left is even and right is odd → swap them.
  2. If left is odd → move left forward.
  3. If right is even → move right backward.
  4. Repeat until left >= right.