Input : arr[] = [0, 1, 0, 1, 0, 0, 1, 1, 1, 0]
Output : arr[] = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
Input : arr[] = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1]
Output : arr[] = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
Input: arr[] = [1, 2, 0, 4, 3, 0, 5, 0]
Output: arr[] = [1, 2, 4, 3, 5, 0, 0, 0]
Explanation: There are three 0s that are moved to the end.
Input: arr[] = [10, 20, 30]
Output: arr[] = [10, 20, 30]
Explanation: No change in array as there are no 0s.
Input: arr[] = [0, 0]
Output: arr[] = [0, 0]
Explanation: No change in array as there are all 0s.
Input: arr = [0, 1, 2, 3, 4]
Output: arr = [0, 2, 4, 1, 3]
Explanation: [0, 2, 4] are even and [1, 3] are odd numbers. Please note that [2, 0, 4, 3, 1] or [4, 2, 0, 1, 3] are also valid outputs. We only need to make sure that all even elements are before all odd.
Input : arr ={1, 5, 11}
Output : arr= {1, 5, 11}
Explanation All numbers are odd.
Input: arr[] = [12, 11, -13, -5, 6, -7, 5, -3, -6]
Output: [-13, -5, -7, -3, -6, 12, 11, 6, 5]
Explanation: All negative elements [-13, -5, -7, -3, -6] were arranged before positive numbers [12, 11, 6, 5]. Note that there can be more than one possible output.
Input: arr[] = [11, -13, 6, -7, 5]
Output: [-13, -7, 11, 6, 5]
Explanation: All negative elements [-13, -7] were arranged before positive numbers [11, 6, 5].