1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-09 11:09:07 +01:00
CodeWars/5kyu/moving_zeros_to_the_end/solution.cs
Matej Focko fc899b0b02
chore: initial commit
Signed-off-by: Matej Focko <mfocko@redhat.com>
2021-12-28 16:19:58 +01:00

13 lines
315 B
C#

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();
}
}