Pairs with mismatched gaps
Given a list of integers nums, count the index pairs i < j whose values move by a different amount than their positions do: nums[j] - nums[i] != j - i. For [3, 7, 5, 6] the answer is 3: the three pairs that use index 1 (the 7) are out of step, and every other pair matches.
nums may be empty and may hold negatives. Checking every pair is O(n²): aim for one pass.
Besides the tests, one large input (4,500 numbers) with a ~150 ms limit (scaled to your device's speed): brute force won't pass.
Examples
mismatched_pairs([3,7,5,6])→3mismatched_pairs([1,2,3,4,5])→0mismatched_pairs([5,5,5])→3