You are given an integer array arr of a fixed size.
Each time a zero appears in the array, you must duplicate it and shift all elements to the right.
The array should not grow beyond its original length.
Any elements pushed out of bounds are removed.
The modification must be done in the same array (in-place).
Input: arr = [8,6,0,4]
Output: [8,6,0,0]
Explanation:
Zero at index 2 is copied and pushes out remaining elements.
Input: arr = [0,1,0,2]
Output: [0,0,1,0]
Explanation:
- First zero → duplicate → [0,0,1,0,2] but we keep only first 4 → [0,0,1,0]
Accepted:
Submission: