using System.Collections.Generic;
public class Solution {
public void DuplicateZeros(int[] arr) {
List<int> intList = new List<int>();
for(int i = 0; i < arr.Length; i++) {
if(arr[i] == 0) {
intList.Add(0);
intList.Add(0);
} else {
intList.Add(arr[i]);
}
}
int[] result = intList.ToArray();
Array.Resize(ref result, arr.Length);
}
}This works in my Visual Studio IDE. However, the test case returns the exact same output as what is entered into the method. Am I missing something? A sanity check would be very useful. Thanks.