12 May 2017

Array Replace

My solution:
int[] arrayReplace(int[] inputArray, int elemToReplace, int substitutionElem) 
{
    return inputArray.Select(i => i == elemToReplace ? substitutionElem : i).ToArray();
}

Previous Next