I have two arrays of the same size, A
and B
.
What would be the fastest way to replace all elements in A
that have value equal to y
to change and be become equal to z
?
The arrays are not small in terms of size.
I can think of a simple for loop
along with using array.get
and then array.set
, but this is not very efficient and is slow, so I was wondering if there is a way without using a loop.
If this is too easy, then would it be possible to also do the same thing for the case that elements in the array are less than equal to y
(instead of only being equal)?