public int Compute(string[] input, int width, int height) { var layersData = DSNImageParser.Parse(input, width, height); var layerData = FindLowerCountOf('0', layersData); return(CountOccurences('1', layerData) * CountOccurences('2', layerData)); }
public string Decode(string[] input, int width, int height) { var layersData = DSNImageParser.Parse(input, width, height); var image = layersData[0].ToCharArray(); for (var l = 1; l < layersData.Length; l++) { for (var i = 0; i < layersData[l].Length; i++) { if (image[i] == '2') { image[i] = layersData[l][i]; } } } return(new string(image)); }