Tap here to switch tabs
Problem
Submissions

Problem: Faulty Sensor

med
30 min
Try to solve the Faulty Sensor problem.

Statement

Two sensors are used to record a sequence of data points. You are given two integer arrays sensor1 and sensor2 of identical length, representing the recorded values.

Exactly one of the sensors might be faulty. A faulty sensor drops exactly one measurement from the stream. As a result, all remaining data points following the dropped value are shifted left by 11 position, and an arbitrary value is appended to the end of that array.

Return 11 if sensor1 is the faulty sensor, or 22 if sensor2 is the faulty sensor. If it cannot be definitively determined which sensor is faulty, return −1-1.

Constraints:

  • sensor1.length == sensor2.length

  • 1≤1 \leq sensor1.length ≤100\leq 100

  • 1≤1 \leq sensor1[i], sensor2[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Faulty Sensor

med
30 min
Try to solve the Faulty Sensor problem.

Statement

Two sensors are used to record a sequence of data points. You are given two integer arrays sensor1 and sensor2 of identical length, representing the recorded values.

Exactly one of the sensors might be faulty. A faulty sensor drops exactly one measurement from the stream. As a result, all remaining data points following the dropped value are shifted left by 11 position, and an arbitrary value is appended to the end of that array.

Return 11 if sensor1 is the faulty sensor, or 22 if sensor2 is the faulty sensor. If it cannot be definitively determined which sensor is faulty, return −1-1.

Constraints:

  • sensor1.length == sensor2.length

  • 1≤1 \leq sensor1.length ≤100\leq 100

  • 1≤1 \leq sensor1[i], sensor2[i] ≤100\leq 100