I have an array of non-unique numbers (x) and another array of the same length with some values (y). I would like to return an array (z) which is the same length as x but only shows the unique values of x when y is a maximum. E.g.
x = [0, 2, 2, 2, 0, 3, 3]
y = [1, 1, 1.5, 1, 1, 1.5, 1]
z = [0, 0, 2, 0, 0, 3, 0]
Does anyone please know how I can get the array z?