I have a list of integer values which can be anywhere between 1 and 4.
So, let's say {1,2,4,1,3,2,1,4,4} for instance.
I now want to reverse the values in the following way:
All entries with ...
There are numerous ways to do this but I want to take the most efficient approach.
Any thoughts?
for(int i = 0; i < array.Length; i++)
{
array[i] = 5 - array[i];
}
Implement this function:
f(x) = 5 - x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With