first[i] and second[i] are the i-th readings of the first and second gauge.
This kind of gauge sometimes fails: it loses exactly one reading. Every reading after the lost one moves one position to the left, and the last position gets a random number that is guaranteed to differ from the lost reading. For example, [1, 2, 3, 4, 5] could become [1, 2, 4, 5, 8] after losing the 3.
At most one gauge failed, and the data fits at least one story: no failure, the first gauge failed, or the second gauge failed.
Return 1 or 2, the number of the gauge that failed. If nothing failed, or the data cannot tell which gauge failed, return -1.first=[7, 3, 9, 4], second=[7, 9, 4, 1] → 2
The second gauge lost the 3: 9 and 4 shifted left and a random 1 appeared at the end. The first gauge's data cannot be explained that way.
first=[5, 5, 8], second=[5, 5, 2] → -1
Only the last value differs. Either gauge could have lost it and put a random value in its place, so the faulty one cannot be told apart.
first=[4, 6, 6, 2], second=[4, 6, 6, 2] → -1
The data matches, so there was no failure.
first=[7, 3, 9, 4], second=[7, 9, 4, 1]
2
Run checks the first 3 tests in your browser. Submit checks all 101 tests on the server, hidden ones included.