1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-22 16:43:46 +01:00
CodeWars/5kyu/moving_zeros_to_the_end/solution.cs

14 lines
315 B
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
public class Kata {
public static int[] MoveZeroes(int[] arr) {
var length = arr.GetLength(0);
var new_arr = arr.Where(x => x != 0).ToList();
for (var i = length - new_arr.Count(); i > 0; i--) new_arr.Add(0);
return new_arr.ToArray();
}
}