sensor1
andsensor2
, wheresensor1[i]
andsensor2[i]
are theith
data points collected by the two sensors.However, this type of sensor has a chance of being defective, which causes exactly one data point to be dropped. After the data is dropped, all the data points to the right of the dropped data are shifted one place to the left, and the last data point is replaced with some random value. It is guaranteed that this random value will not be equal to the dropped value.
- For example, if the correct data is
[1,2,**3**,4,5]
and3
is dropped, the sensor could return[1,2,4,5,**7**]``7
).
1
or2
) with the defect. If there is no defect in either sensor or if it is impossible to determine the defective sensor, return-1
.
1 | class Solution { |